[concurrency-interest] ThreadPoolExecutor - cancel rejected tasks with Discard*Policy?

Doug Lea dl at cs.oswego.edu
Mon Feb 17 07:01:35 EST 2020


On 2/16/20 10:16 AM, Viktor Klang via Concurrency-interest wrote:
> The real downside with CallerRunsPolicy is that it discards Runnables
> when the pool is shutting down, which means that in all cases where
> there might be a race condition between shutting down and submitting
> tasks, they may not get run at all :S
> 

Some people would complain about the opposite policy choice as a
downside. The main moral for JDK components is that predefining only a
few of many possibly policies for the sake of convenience is not usually
a good idea.

-Doug





More information about the Concurrency-interest mailing list