Background:
I need to use java.util.concurrent.Executor
to serialize the execution of some legacy code inside a WebService.
I have added an member variable, executor, to the WebService class. It is injected from the outside by the springframework.
The executor bean is defined as such:
<bean id="riskValueEstimateUpdateExecutor" scope="singleton"
class="java.util.concurrent.Executors"
factory-method="newSingleThreadExecutor" />
- Tomcat version: 6.0.22
- Java version: 1.6
- spring framework: 2.5.5
Problem:
The WS works as expected. We rolled it out to a linux server. Then we realised the tomcat stop script could no longer stop the service.
I use kill -3 to the tomcat instance. In the thread dump I find these lines:
"pool-2-thread-1" prio=10 tid=0xad637c00 nid=0xf37 waiting on condition [0xae882000..0xae883020]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0xb453b710> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:946)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906)
at java.lang.Thread.run(Thread.java:619)
How can I fix this problem?
If you need more information, please suggest.