I'm using JBoss 5.1 and leveraging org.jboss.util.threadpool.BasicThreadPool to manage a pool of threads. Specifically, leveraging JBossWorkManager beans that have a dependency on BasicThreadPool. Say I have a caller that enqueues runnables to the thread pool. I want the caller to block when the thread pool queue is full using the following configuration (snippet):
<property name="maximumQueueSize">1024</property>
<property name="minimumPoolSize">1</property>
<property name="maximumPoolSize">20</property>
<property name="keepAliveTime">60000</property>
<property name="blockingMode">wait</property>
Where the blockingMode of wait is used to block the caller (see http://community.jboss.org/wiki/ConfigBasicThreadPool). Now when the queue is full the subsequent enqueue does not block the caller, instead it runs the runnable as the caller.
How do I get the caller to block? Mind you that I'm required to use JBossWorkManager.