Description
While making some stress tests of my application, that uses mina on client and server sides, I discovered that sometimes mina leaves some threads to work after session.close(false) and connector.dispose(false).
ExceptionMonitor says that there is an exception
java.nio.channels.ClosedSelectorException
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:66)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
at org.apache.mina.transport.socket.nio.NioProcessor.select(NioProcessor.java:70)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1067)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Then I tried to dig deeper. And I've found the loop in AbstractPollingIoProcessor.Processor.run
for (; {
try
catch (Throwable t)
{ ExceptionMonitor.getInstance().exceptionCaught(t); //... }}
This loop is definitely infinite, if select throws ClosedSelectorException.
So, ClosedSelectorException have to be processed with another way.