Hello, 

i read the FAQ entry about closing sessions here mina.apache.org/faq.html and 
also through the mailling list.

However im not sure how i should apply it to my use case.

I've created a very simple policy service similar to this example
http://jglatre.blogspot.de/2009/03/implementing-greylist-for-postfix-with.html

The faq states something about

ConnectFuture cf = connector.connect(new InetSocketAddress("localhost", 8080));

but i dont see how this applies to an IoAcceptor - i start my service like in 
the above example

IoAcceptor acceptor = new NioSocketAcceptor();  
      acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new 
ApdCodecFactory()));  
      acceptor.setHandler( new DummyApdHandler() );  
      acceptor.getSessionConfig().setReadBufferSize( 2048 );  
      acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 10 );  
      acceptor.bind( new InetSocketAddress(6666) );  

i would expect that upon VM shutdown that all open sessions are closed - 
however they are not - my postfix server keeps a session open for quiet a while 
- so when i restart my java server (standalone service) i get the bind error - 
address already in use.

Any hints? I tried a shutdown hook and manually do a acceptor.unbind() but that 
didnt do the trick either!

Thanks

Reply via email to