I have implemented reconnection in an IoFilter like the following:
filterClose(Session session...) {
IoConnector connector = (IoConnector)session.getService();
InetSocketAddress remoteAddress =
(InetSocketAddress)session.getAttribute("session.remoteAddress");
ConnectFuture future = connector.connect(remoteAddress, new
ClientSessionInitializer(session));
ConnectFuture future2 = future.awaitUninterruptibly();
if(future2.isConnected())
{
IoSession newSession = future2.getSession();
...
}
...
}
Yet somehow, usually on windows xp single core machine, it seems that my
previous session is still up and doesn't get garbaged collected.
Is there a way to reuse my previous session object when reconnecting or
do I have to create a new session like I did?
Are the two session objects independent or are they still "linked"
together? Does it make a different if I obtain the connector from
session.getService() or if I use call my global instance?
I would really like to know how to properly do reconnection and most
importantly, statefull reconnection.
Thanks,
Simon