Package org.jboss.netty.example.discard
Class DiscardClientHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.example.discard.DiscardClientHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler
public class DiscardClientHandler extends SimpleChannelUpstreamHandler
Handles a client-side channel.
-
-
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 byte[]contentprivate longtransferredBytes
-
Constructor Summary
Constructors Constructor Description DiscardClientHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannelis open, bound to a local address, and connected to a remote address.voidchannelInterestChanged(ChannelHandlerContext ctx, ChannelStateEvent e)Invoked when aChannel'sinterestOpswas changed.voidexceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)Invoked when an exception was raised by an I/O thread or aChannelHandler.private voidgenerateTraffic(ChannelStateEvent e)longgetTransferredBytes()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.private ChannelBuffernextMessage()voidwriteComplete(ChannelHandlerContext ctx, WriteCompletionEvent e)Invoked when something was written into aChannel.-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelDisconnected, channelOpen, channelUnbound, childChannelClosed, childChannelOpen
-
-
-
-
Method Detail
-
getTransferredBytes
public long getTransferredBytes()
-
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
-
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
-
channelInterestChanged
public void channelInterestChanged(ChannelHandlerContext ctx, ChannelStateEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannel'sinterestOpswas changed.- Overrides:
channelInterestChangedin classSimpleChannelUpstreamHandler
-
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
-
writeComplete
public void writeComplete(ChannelHandlerContext ctx, WriteCompletionEvent e)
Description copied from class:SimpleChannelUpstreamHandlerInvoked when something was written into aChannel.- Overrides:
writeCompletein 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
-
generateTraffic
private void generateTraffic(ChannelStateEvent e)
-
nextMessage
private ChannelBuffer nextMessage()
-
-