Thanks for the info Trustin
Just for completeness, what will currently happen in the scenario I described, without using the Hashmap workaround ?


Trustin Lee wrote:
Hello Maarten,

This is a known issue:

We'll provide a setter or a unbind method with an extra parameter to make acceptors close all client connections immediately.


2005/10/6, Maarten Bosteels <>:

I am checking out MINA and it looks very interesting.

My first question:  when I call unbind(service) or unbindAll() on a
will it wait until all running I/O events are handled ?

In other words:  suppose my  IoHandlerAdapter implementation looks like this

public void dataRead( IoSession session, ByteBuffer rb )
    ByteBuffer wb = ByteBuffer.allocate( 4 );
    int res = somethingThatTakesSomeTime();
    wb.putInt ( res );
    session.write( wb, null );

And thread_x calls unbindAll() while thread_y is busy with somethingThatTakesSomeTime().
Will unbindAll() wait until dataRead() finishes or will thread_y get interrupted somehow ?

I guess I could just try it out, but I would rather like to know what is the intended behaviour.

On a sidenote: is it common to create a 'private' shutdownService (only accepting connections from localhost)
that just waits for a shutdown command, and then tries to gracefully shutdown ?
(like Tomcat does on port 8005)


what we call human nature is actually human habit