[concurrency-interest] Concurrency-interest Digest, Vol 35, Issue 22

Martin Buchholz Martin.Buchholz at Sun.COM
Tue Dec 18 12:59:04 EST 2007


Moran,
This bug was fixed in 6.0 build 93,
apparently by fix for:

6440728: ThreadPoolExecutor can fail to execute successfully submitted
tasks as specified
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6440728

Martin

> Message: 2
> Date: Tue, 18 Dec 2007 17:16:28 +0200
> From: "Moran Avigdor" <moran at gigaspaces.com>
> Subject: [concurrency-interest] ThreadPoolExecutor with corePoolSize
> 	as Zero
> To: <concurrency-interest at cs.oswego.edu>
> Message-ID:
> 	<3623E06481E65B45866CB3AF32C4FA87A325C1 at hercules.gspaces.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> When initializing a thread pool with a core-pool-size of Zero I see that
> no threads execute the runnable tasks.
> 
> Looking at this further it seems that only if the queue rejected the
> offer, then a first thread will be created.
> 
>  
> 
> A ThreadPoolExecutor with a SynchronousQueue() will work - but a
> LinkedBlockingQueue() will not.
> Is this considered a known limitation? Must I initialize my pool with
> corePoolSize as 1 with an unbounded queue?
> 
>  
> 
> ThreadPoolExecutor pool = new ThreadPoolExecutor(0, 10, 60L,
> TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
> 
>             
> 
> for (int i=0; i<10; ++i)
> 
> {
> 
>       pool.execute(new Runnable() {
> 
>             public void run() {
> 
>                   System.out.println("running");
> 
>             };
> 
> });
> 
> }
> 
>  
> 
> Thanks.
> 


More information about the Concurrency-interest mailing list