[concurrency-interest] Whats up with the ThreadPoolExecutor?
dholmes at dltech.com.au
Mon Aug 22 20:27:45 EDT 2005
> I don't know if this is a bug or me just using it wrongly. But I add
> work to the pool, and I add the same Runnable each time. Since I try to
> avoid GC. But it seems that it doesn't process the full queue. If I
> create a new Runnable each time its ok.
As Tim indicated this is indeed a bug, but one only exercised under
- there are >= core-size threads already in the pool
- the queue is bounded and full
- you've submitted the same Runnable multiple times
So change any of the above and you can work-around the problem.
There is an easy fix that Dawid can hopefully get into the backport in the
very near future:
- addIfUnderCorePoolSize needs to be changed to return an int <0, 0 or >0 to
represent the three cases it is checking for.
More information about the Concurrency-interest