|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPooledExecutor
org.jboss.util.threadpool.MinPooledExecutor
A pooled executor where the minimum pool size threads are kept alive. This is needed in order for the waitWhenBlocked option to work because of a race condition inside the Executor. The race condition goes something like: RT - Requesting Thread wanting to use the pool LT - Last Thread in the pool RT: Check there are enough free threads to process, yes LT is there, so no need to create a new thread. LT: Times out on the keep alive, LT is destroyed. RT: Try to execute, blocks because there are no available threads. In fact, the pool is now empty which the executor mistakenly inteprets as all of them being in use. Doug Lea says he isn't going to fix. In fact, the version in j2se 1.5 doesn't have this option. In order for this to work, the min pool size must be > 0.
Field Summary | |
protected int |
keepAliveSize
The number of threads to keep alive threads |
Constructor Summary | |
MinPooledExecutor(Channel channel,
int poolSize)
Construct a new executor |
|
MinPooledExecutor(int poolSize)
Construct a new executor |
Method Summary | |
int |
getKeepAliveSize()
|
protected java.lang.Runnable |
getTask()
|
protected boolean |
keepAlive()
We keep alive unless we are told to shutdown or there are more than keepAliveSize threads in the pool |
void |
setKeepAliveSize(int keepAliveSize)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int keepAliveSize
Constructor Detail |
public MinPooledExecutor(int poolSize)
poolSize
- the minimum pool sizepublic MinPooledExecutor(Channel channel, int poolSize)
channel
- the queue for any requestspoolSize
- the minimum pool sizeMethod Detail |
public int getKeepAliveSize()
public void setKeepAliveSize(int keepAliveSize)
keepAliveSize
- the number of threads to keep aliveprotected java.lang.Runnable getTask() throws java.lang.InterruptedException
java.lang.InterruptedException
protected boolean keepAlive()
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |