[concurrency-interest] ThreadPoolExecutor question

Doug Lea dl@cs.oswego.edu
Thu, 30 Dec 2004 08:50:11 -0500

> Hmmm... But if I set core size to 0, the above will have no effect; and 
> when I set core size to max, the workers will not die out, isn't that 
> right? 

Right, sorry. And all the ways I can think of to get the desired
effect are awful. (For example using get/setCorePoolSize in execute
and afterExecute.)

As Gregg implied, the reason for promising to keep core threads alive
is to guarantee some minimal concurrency level that may be needed to
preserve application liveness. But we could have provided some means to
allow dynamic idle timeouts and re-creation of these core threads
for people who are otherwise sure it is OK in a given application.
We'll consider adding method allowIdleTimeoutsForCoreThreads or somesuch.