[concurrency-interest] ThreadPoolExecutor'sallowCoreThreadTimeOut
Moran Avigdor
moran at gigaspaces.com
Tue Aug 28 05:24:53 EDT 2007
David,
Thank you for your help.
Moran
________________________________
From: David Holmes [mailto:dcholmes at optusnet.com.au]
Sent: Tuesday, August 28, 2007 5:14 AM
To: Moran Avigdor; concurrency-interest at cs.oswego.edu
Subject: RE: [concurrency-interest]
ThreadPoolExecutor'sallowCoreThreadTimeOut
Moran,
It is a known bug: 6458662
It is fixed in Java 7 but not Java 6.
David
-----Original Message-----
From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Moran
Avigdor
Sent: Monday, 27 August 2007 10:23 PM
To: dholmes at ieee.org; concurrency-interest at cs.oswego.edu
Subject: Re: [concurrency-interest]
ThreadPoolExecutor'sallowCoreThreadTimeOut
David,
Thank you for looking into this. I have written a recreation
code to ease our discussion.
We are using the latest 1.6.0_02-b06 on a windows machine.
The code opens a ThreadPoolExecutor with a capacity limited
LinkedBlockingQueue in order
to trigger pool sizing. The code checks that the number of pool
threads does not go below the
Core pool size.
The following is the output when it fails.
ThreadPoolExecutor with:
CORE_POOL_SIZE = 4
MAX_POOL_SIZE = 16
KEEP_ALIVE_TIMEOUT = 10
QUEUE_SIZE = 2
java -verions: 1.6.0_02
------------------------------------------------------
...
Pool Threads: 7
java.lang.ThreadGroup[name=main,maxpri=10]
Thread[main,5,main]
Thread[pool-1-thread-1,5,main]
Thread[pool-1-thread-2,5,main]
Thread[pool-1-thread-3,5,main]
Thread[pool-1-thread-4,5,main]
Thread[pool-1-thread-5,5,main]
Thread[pool-1-thread-6,5,main]
Thread[pool-1-thread-7,5,main]
Pool Threads: 0
java.lang.ThreadGroup[name=main,maxpri=10]
Thread[main,5,main]
Exception in thread "main" java.lang.IllegalStateException: core
pool size is below minimum, expected: 4 actual: 0
at test.TestTPE.monitorPoolThreads(TestTPE.java:117)
at test.TestTPE.main(TestTPE.java:17)
Just a final note - if you run this exact test with java 1.5
(e.g. 1.5.0_12) this does not happen.
Thank you for your time.
Moran Avigdor
________________________________
From: David Holmes [mailto:dcholmes at optusnet.com.au]
Sent: Monday, August 27, 2007 12:50 AM
To: Moran Avigdor; concurrency-interest at cs.oswego.edu
Subject: RE: [concurrency-interest] ThreadPoolExecutor's
allowCoreThreadTimeOut
Moran,
How you were actually constructing the ThreadPoolExecutor?
David Holmes
-----Original Message-----
From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Moran
Avigdor
Sent: Sunday, 26 August 2007 7:27 PM
To: concurrency-interest at cs.oswego.edu
Subject: [concurrency-interest] ThreadPoolExecutor's
allowCoreThreadTimeOut
I have noticed some strange behavior using the
ThreadPoolExecutor when moving to java 1.6 (1.6.0_02-b06 on windows xp)
Core pool threads were being terminated although I was
explicitly setting the core pool size:
ThreadPoolExecutor(int corePoolSize, int
maximumPoolSize, long keepAliveTime, TimeUnit unit,
BlockingQueue<Runnable>
workQueue, ThreadFactory threadFactory)
I noticed it when JConsole was up and monitoring the
thread consumption. After my 1 min timeout, all threads were terminated.
In 1.6, the new allowCoreThreadTimeOut(boolean value)
will in fact explain this behavior if value is set to true - But I am
not explicitly calling it, but instead using the constructor above.
I should not that on a linux running 1.6.0-rc-b104 it
seemed to have behaved as expected.
Is anyone aware of such a fix or a known issue?
Thanks in advance.
---
Moran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070828/9b46fc54/attachment-0001.html
More information about the Concurrency-interest
mailing list