Netty client: handling disconnections
Murali Mohan Rath
mmrath at gmail.com
Thu Jun 24 22:06:55 EDT 2010
Hi All,
I searched the forum for what I am looking for could not get much
information. Here is what I want to do.
I have a client which can open a single connection to server(not Netty). On
connect I am getting hold of the channel in a requester object as below
@Override
public void channelConnected(
ChannelHandlerContext ctx, ChannelStateEvent e) {
requester.setChannel(e.getChannel());
try{
requester.requestDatabaseStatus();
}catch (IOException exception){
logger.error("Error while requesting deal status",exception);
}
}
The requester object is used from various places in the application to send
request. Now my target is to handle the disconnections. Whenever there is a
disconnection I want to retry connecting every 10 seconds and once connected
the requester will be updated by the new channel.
I am not sure which is the best place to detect such disconnection and what
is the best approach to reconnect. Any information around this will be great
help.
FYI. a) I have a heartbeat handler to send a ping message if the connection
is idle for few seconds. b) while connecting I am setting keepAlive to true;
Thanks,
Murali
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Netty-client-handling-disconnections-tp5220338p5220338.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list