I found the problem.
I had to destroy the threadpool explicitly just before I unbind and dispose the 
acceptor, apparently it leaves some threads hanging.
I would expect the dispose to do that for me... 

-----Original Message-----
From: Guy Itzhaki [mailto:[email protected]] 
Sent: Tuesday, May 12, 2015 6:40 PM
To: [email protected]
Subject: disposing acceptor does not terminate all the 
OrderedThreadPoolExecutor threads

Dear Forum,
I'm terminating my mina based server using acceptor.unbind(); 
acceptor.dispose(true);

However I noted that the executor's resources are not totally freed, some of 
its threads remains alive. This prevents my application from terminating 
gracefully.

This is the stack trace of one of the threads:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.fetchSession(OrderedThreadPoolExecutor.java:730)
org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:683)
java.lang.Thread.run(Thread.java:745)

Is there a way to overcome this? What am I doing wrong?
I'm using mina 2.0.9

Thanks a lot
Guy

Reply via email to