Dear MINA users.

I’m using MINA server acceptor in my Java application that needs to be 
restarted from time to time.
When I stop and start that application „too fast” I always get an exception 
when starting and trying to bind:

java.io.IOException: Error while binding on 0.0.0.0/0.0.0.0:8245
original message : Address already in use

It must mean that I’m not closing all connections correctly upon application 
termination.
I have tried many things but nothing helped.

When terminating application I’m closing all sessions (most often there is only 
one session open), wait for the session to close gracefully and then I fire 

acceptor.dispose(true);

I’m not calling acceptor.unbind() because it is already called inside 
dispose(). Right?

After few minutes I can always start my application and then
acceptor.bind(new InetSocketAddress(port));
will work correctly not throwing any Exception.

OS: macOS 10.12 and Ubuntu
Java: 1.8.0_60 x64
MINA: 2.0.14

Best regards
Michał Gałuszka

Reply via email to