mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Trudeau" <strud...@bluetreewireless.com>
Subject RE: [Q] Statefull session reconnection
Date Mon, 02 Jun 2008 19:02:25 GMT
Thanks Niklas, it seems that forwarding the filterClose() event did the
trick. Thanks.

-----Original Message-----
From: Niklas Therning [mailto:niklas@trillian.se] 
Sent: June-02-08 2:27 AM
To: users@mina.apache.org
Subject: Re: [Q] Statefull session reconnection

I think your code looks ok. Some things that come to mind:

* You need to foward the filterClose() call to the nextFilter otherwise
your old session won't be closed.
* MINA will call sessionClosed() for the old session so your filter
needs to intercept that event and hide it from the filters and the
handler after your reconnect filter.
* You might want to hide the sessionCreated() and sessionOpened() events
for the new session as well.

This JIRA issue may be of interest to you: 
https://issues.apache.org/jira/browse/DIRMINA-68. There's a patch
attached there for a reconnect filter. I don't know if it does what you
want. Maybe it can be adapted to your needs?



Simon Trudeau skrev:
> 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

View raw message