ExecutorService's surprising performance break-even point — rules of thumb?

后端 未结 9 2013
臣服心动
臣服心动 2020-12-08 03:10

I\'m trying to figure out how to correctly use Java\'s Executors. I realize submitting tasks to an ExecutorService has its own overhead. However, I\'m surpris

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 03:39

    The Fixed ThreadPool's ultimate porpose is to reuse already created threads. So the performance gains are seen in the lack of the need to recreate a new thread every time a task is submitted. Hence the stop time must be taken inside the submitted task. Just with in the last statement of the run method.

提交回复
热议问题