Java的Fork / Join vs ExecutorService - 何时使用?
我刚刚阅读这篇文章:这里
,并认为答案不够直观。
I just finished reading this post: here and felt that the answer is not straight enough.
您可以用简单的语言和示例解释,
Can you explain in simple language and examples, what are the trade-offs between Java 7's Fork-Join framework and the older solutions?
我还阅读了Google的#1的主题 href =http://www.javaworld.com/article/2078440/enterprise-java/java-tip-when-to-use-forkjoinpool-vs-executorservice.html =nofollow>此处但是这篇文章没有回答时标题问题,它大部分涉及api差异...
I also read the Google's #1 hit on the topic here but the article doesn't answer the title question when, it talks about api differences mostly ...
Fork-join允许您轻松执行分割和征服作业,如果要在ExecutorService中执行,则必须手动执行。实际上,ExecutorService通常用于同时处理许多独立请求(也称为事务),而fork-join则用于加速一个连贯的作业。
Fork-join allows you to easily execute divide and conquer jobs, which have to be implemented manualy if you want to execute it in ExecutorService. In practice ExecutorService is usualy used to process many independent requests (aka transaction) concurrently, and fork-join when you want to accelerate one coherent job.