[concurrency-interest] ThreadPoolExecutor corePoolSize incompatibility between backport and j.u.c.

Greg Luck gluck at gregluck.com
Sat Aug 16 07:54:53 EDT 2008

I am looking at moving the new version of ehcache to j.u.c, from  
backport, as part of dropping support for Java 1.4.

It turns out that all my tests which test code that uses backport's  
ThreadPoolExecutor never complete. The code which supplies the  
executor is shown below:

      * @return Gets the executor service. This is not publically  
     ThreadPoolExecutor getExecutorService() {
         if (executorService == null) {
             synchronized (this) {
                 //0, 10, 60000, ?, Integer.MAXVALUE
                 executorService = new ThreadPoolExecutor(0,10,
                        60000, TimeUnit.MILLISECONDS, new  
         return executorService;

Without understanding exactly why, I tried changing the corePoolSize  
to 1. This fixed the problem. My question is why? There is nothing in  
the JavaDoc I can see which says you must use a minimum of 1.

And I am now worried that j.u.c. is flaky in Java 5.  Any comments  
from the list would be much appreciated.


Greg Luck

web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20080816/5f964188/attachment.html>

More information about the Concurrency-interest mailing list