Le 04/01/16 14:10, Guy Itzhaki a écrit : > Thanks for the reply > I tried that, but disposing the ioService might block my thread as well
The thing is that you may have working sessions. dispose() class dispose0() which calls unbind() which calls unbind0() which wait on a future to be completed : @Override protected final void unbind0(List<? extends SocketAddress> localAddresses) throws Exception { AcceptorOperationFuture future = new AcceptorOperationFuture(localAddresses); cancelQueue.add(future); startupAcceptor(); wakeup(); future.awaitUninterruptibly(); but I don't think this is where you are having an issue. I'm pretty sure you can call dispose() and it will return quite instantaneously. You might have something more to do : closing all the pending sessions. Thsi can be done by requesting the list of existing sessions : /** * Returns the map of all sessions which are currently managed by this * service. The key of map is the {@link IoSession#getId() ID} of the * session. * * @return the sessions. An empty collection if there's no session. */ Map<Long, IoSession> getManagedSessions(); and then for each session, do : for ( IoSession session : getManagedSessions().values() ) { // Close teh session inconditionally session.close( true ); } Otherwise you may have sessions with pending data to be sent that will never be sent because teh socket is closed. Note that it's probably something we should handle in the dispose() method, and I would suggest you create a JIRA for that. Just let me know if it solves your issue. PS : we have just release MINA 2.0.10. You might want to switch to this version (it won't solve your issue, it's just that it's the latest version). Many thanks !