Package org.jboss.netty.example.uptime
Class UptimeClientHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.example.uptime.UptimeClientHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler
public class UptimeClientHandler extends SimpleChannelUpstreamHandler
Keep reconnecting to the server while printing out the current uptime and connection attempt status.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor Description UptimeClientHandler(ClientBootstrap bootstrap, Timer timer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannelwas closed and all its related resources were released.voidchannelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannelis open, bound to a local address, and connected to a remote address.voidchannelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannelwas disconnected from its remote peer.voidexceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)Invoked when an exception was raised by an I/O thread or aChannelHandler.-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, messageReceived, writeComplete
-
-
-
-
Constructor Detail
-
UptimeClientHandler
public UptimeClientHandler(ClientBootstrap bootstrap, Timer timer)
-
-
Method Detail
-
channelDisconnected
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelwas disconnected from its remote peer.- Overrides:
channelDisconnectedin classSimpleChannelUpstreamHandler
-
channelClosed
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelwas closed and all its related resources were released.- Overrides:
channelClosedin classSimpleChannelUpstreamHandler
-
channelConnected
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelis open, bound to a local address, and connected to a remote address.
Be aware that this event is fired from within the I/O thread. You should never execute any heavy operation in there as it will block the dispatching to other workers!- Overrides:
channelConnectedin classSimpleChannelUpstreamHandler
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler
-
-