Adam Brown wrote:
I'm trying to modify our server to allow a message to cause it to clean up
and exit.  Currently, I've got code in our IoHandler that receives the
message and cleans up 'everything else', but when I try to unbind() the
IoAcceptor, the thread exits and leaves the connection unclosed (ie: the
telnet session I am testing with remains open).  Additionally, I still see a
couple of MINA-related threads running (and NioProcessor thread & some
thread-pool threads).

What am I missing?  Am i going about this the wrong way?

-adam

I basically do shutdown same as you. Only difference is that I close the open session first:

public class ShutdownCommand extends TextProtocolCommand {
...
        public ProtocolResponse execute() throws Exception {
...
                CloseFuture closeFuture = getSession().close(closeImmediately);
                closeFuture.addListener(new CloseSessionListener());
                return null;
        }
...
        class CloseSessionListener implements IoFutureListener<CloseFuture> {
                public void operationComplete(CloseFuture future) {
                        getServerControl().shutDown();
                }
        }
}


public class CacheServer implements CacheServerControl {
...
        public void shutdown() {
logger.debug("{} protocol processor shutting down server socket", protocolType);
                protocolAcceptor.unbind();
                protocolAcceptor.dispose();
        }       

        private String protocolType;
        private SocketAcceptor protocolAcceptor;
        private Logger logger;
}



Maybe try doing a thread dump and see where in the code the remaining threads are hanging.

HTH,

DR

Reply via email to