Class FactorialClientHandler
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.jboss.netty.example.factorial.FactorialClientHandler
- All Implemented Interfaces:
ChannelHandler
,ChannelUpstreamHandler
Handler for a client-side channel. This handler maintains stateful
information which is specific to a certain channel using member variables.
Therefore, an instance of this handler can cover only one channel. You have
to create a new handler instance whenever you create a new channel and insert
this handler to avoid a race condition.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final BlockingQueue<BigInteger>
private int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when aChannel
is open, bound to a local address, and connected to a remote address.void
Invoked when aChannel
'sinterestOps
was changed.void
Invoked when an exception was raised by an I/O thread or aChannelHandler
.void
Handles the specified upstream event.void
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.private void
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelDisconnected, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, writeComplete
-
Field Details
-
i
private int i -
receivedMessages
private int receivedMessages -
answer
-
-
Constructor Details
-
FactorialClientHandler
public FactorialClientHandler()
-
-
Method Details
-
getFactorial
-
handleUpstream
Description copied from class:SimpleChannelUpstreamHandler
Handles the specified upstream event. Down-casts the received upstream event into more meaningful sub-type event and calls an appropriate handler method with the down-casted event.- Specified by:
handleUpstream
in interfaceChannelUpstreamHandler
- Overrides:
handleUpstream
in classSimpleChannelUpstreamHandler
- Parameters:
ctx
- the context object for this handlere
- the upstream event to process or intercept- Throws:
Exception
-
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
-
channelInterestChanged
Description copied from class:SimpleChannelUpstreamHandler
Invoked when aChannel
'sinterestOps
was changed.- Overrides:
channelInterestChanged
in classSimpleChannelUpstreamHandler
-
messageReceived
Description copied from class:SimpleChannelUpstreamHandler
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.- Overrides:
messageReceived
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
-
sendNumbers
-