Thank you Emmanuel for the details.

When I read your reply, a doubt popped up in my head. Hence I would like to
clarify my doubt with you.

During the time of closing the the managed sessions(as explained above -
closing all the pending sessions.), is there anything that the developer
need to perform in order to prevent any new sessions from getting
established. Will any new sessions prevent or delay graceful shut down of
the service? Is such a mechanism already handled in mina framework?

Richards Peter.

On Mon, Jan 4, 2016 at 7:39 PM, Emmanuel Lécharny <elecha...@gmail.com>
wrote:

> 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 !
>
>

Reply via email to