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 ClientBootstrap
private long
private final Timer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when aChannel
was closed and all its related resources were released.void
Invoked when aChannel
is open, bound to a local address, and connected to a remote address.void
Invoked when aChannel
was disconnected from its remote peer.void
Invoked when an exception was raised by an I/O thread or aChannelHandler
.(package private) InetSocketAddress
private void
Methods 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:SimpleChannelUpstreamHandler
Invoked when aChannel
was disconnected from its remote peer.- Overrides:
channelDisconnected
in classSimpleChannelUpstreamHandler
-
channelClosed
Description copied from class:SimpleChannelUpstreamHandler
Invoked when aChannel
was closed and all its related resources were released.- Overrides:
channelClosed
in classSimpleChannelUpstreamHandler
-
channelConnected
Description copied from class:SimpleChannelUpstreamHandler
Invoked when aChannel
is 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:
channelConnected
in classSimpleChannelUpstreamHandler
-
exceptionCaught
Description copied from class:SimpleChannelUpstreamHandler
Invoked when an exception was raised by an I/O thread or aChannelHandler
.- Overrides:
exceptionCaught
in classSimpleChannelUpstreamHandler
-
println
-