Class FactorialServerHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.example.factorial.FactorialServerHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler
public class FactorialServerHandler extends SimpleChannelUpstreamHandler
Handler for a server-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
Fields Modifier and Type Field Description private java.math.BigIntegerfactorialprivate intlastMultiplier
-
Constructor Summary
Constructors Constructor Description FactorialServerHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.voidhandleUpstream(ChannelHandlerContext ctx, ChannelEvent e)Handles the specified upstream event.voidmessageReceived(ChannelHandlerContext ctx, MessageEvent e)Invoked when a message object (e.g:ChannelBuffer) was received from a remote peer.-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, writeComplete
-
-
-
-
Method Detail
-
handleUpstream
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerHandles 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:
handleUpstreamin interfaceChannelUpstreamHandler- Overrides:
handleUpstreamin classSimpleChannelUpstreamHandler- Parameters:
ctx- the context object for this handlere- the upstream event to process or intercept- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.- Overrides:
messageReceivedin classSimpleChannelUpstreamHandler
-
channelDisconnected
public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelwas disconnected from its remote peer.- Overrides:
channelDisconnectedin 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
-
-