Code Review 7091003: ScheduledExecutorService never executes Runnable with corePoolSize of zero

Doug Lea dl at cs.oswego.edu
Thu Sep 22 23:26:43 UTC 2011


On 09/22/11 17:45, David Holmes wrote:
> Sorry Doug/Chris I should have seen this previously, the order here is wrong:
>
> 1552 void ensurePrestart() {
> 1553 int wc = workerCountOf(ctl.get());
> 1554 if (wc == 0)
> 1555 addWorker(null, false);
> 1556 else if (wc < corePoolSize)
> 1557 addWorker(null, true);
> 1558 }
>
> this will always mark the first worker as non-core even if the corePoolSize is >
> 0. It needs to be swapped


Where "needs" means "to be even more accommodating".
I agree; done.

-Doug



More information about the core-libs-dev mailing list