Apache Directory Project - Converting from netty2 question

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > June 2005 > Converting from netty2 question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Converting from netty2 question
Barry Kaplan

2005-06-09, 5:45 pm

I'm converting the quicfixj from netty2 to mina and [think] I am nearly done. (BTW, I did not write the orignal netty2 layer for quickfixj, so I'm learning as I go.)

But I can't figure out one thing. With netty, quickfixj would save off its netty Session instances, and on a timer would check if they have dropped their connection. If so it would invoke Session.start().

Is there any corresponding capability in mina? I'm using the ProtocolConnector, but it does not seem to retain the socket address after the invocation to connect. (Where netty Session did retain this information.) Am I going to have to create a little cla
ss to hold onto the socket address for reconnection?

--
barry kaplan
groups1-oTlvBSL8hjVBDgjK7y7TUQ@public.gmane.org

Trustin Lee

2005-06-10, 2:45 am

Hi Barry,

2005/6/10, Barry Kaplan <groups1-oTlvBSL8hjVBDgjK7y7TUQ@public.gmane.org>:
>
> But I can't figure out one thing. With netty, quickfixj would save off its
> netty Session instances, and on a timer would check if they have dropped
> their connection. If so it would invoke Session.start().
>
> Is there any corresponding capability in mina? I'm using the
> ProtocolConnector, but it does not seem to retain the socket address after
> the invocation to connect. (Where netty Session did retain this
> information.) Am I going to have to create a little class to hold onto the
> socket address for reconnection?


You're right. I removed Session.start() method. I added IoConnector
instead. Here is the example code:
public void sessionClosed( ProtocolSession session ) throws Exception
{
// Wait for five seconds before reconnecting; you'll have to perform
reconnection in other
// thread actually. I just slept here for brevity.
Thread.sleep( 5000 );
// Reconnect.
connector.connect( session.getRemoteAddress(), this );
}
Possibly you'd better to extract this code to a method like 'reconnect()'
so that it can reusable in more than one place.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com