[concurrency-interest] Questions about ThreadPoolExecutor

Joe Bowbeer joe.bowbeer at gmail.com
Wed Mar 1 23:09:12 EST 2006


One more hint:

Grace.Kwok at mscibarra.com wrote:
> Currently, if thread count is exceeding a threshold, it would use the
> current thread to run the tasks in the batch single-threadedly and use
> other threads in pool when they become available.

Note that this is similar to ThreadPoolExecutor.CallerRunsPolicy.

If you set the maximum pool size on your ThreadPoolExecutor and assign
CallerRunsPolicy() as the rejectedExecutionHandler, then tasks
submitted while the active thread limit has been reached will be
executed in the submitting thread.



More information about the Concurrency-interest mailing list