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
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 -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ClientBootstrapprivate longprivate final Timer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when aChannelwas closed and all its related resources were released.voidInvoked when aChannelis open, bound to a local address, and connected to a remote address.voidInvoked when aChannelwas disconnected from its remote peer.voidInvoked when an exception was raised by an I/O thread or aChannelHandler.(package private) InetSocketAddressprivate voidMethods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, messageReceived, writeComplete
-
Field Details
-
bootstrap
-
timer
-
startTime
private long startTime
-
-
Constructor Details
-
UptimeClientHandler
-
-
Method Details
-
getRemoteAddress
InetSocketAddress getRemoteAddress() -
channelDisconnected
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelwas disconnected from its remote peer.- Overrides:
channelDisconnectedin classSimpleChannelUpstreamHandler
-
channelClosed
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelwas closed and all its related resources were released.- Overrides:
channelClosedin classSimpleChannelUpstreamHandler
-
channelConnected
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
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler
-
println
-