public class ChannelDuplexHandler extends ChannelInboundHandlerAdapter implements ChannelOutboundHandler
ChannelHandler
implementation which represents a combination out of a ChannelInboundHandler
and
the ChannelOutboundHandler
.
It is a good starting point if your ChannelHandler
implementation needs to intercept operations and also
state updates.ChannelHandler.Sharable
Constructor and Description |
---|
ChannelDuplexHandler() |
channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise future) throws Exception
ChannelHandlerContext.bind(SocketAddress, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.bind
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the bind operation is madelocalAddress
- the SocketAddress
to which it should boundfuture
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise future) throws Exception
ChannelHandlerContext.connect(SocketAddress, SocketAddress, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.connect
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the connect operation is maderemoteAddress
- the SocketAddress
to which it should connectlocalAddress
- the SocketAddress
which is used as source on connectfuture
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void disconnect(ChannelHandlerContext ctx, ChannelPromise future) throws Exception
ChannelHandlerContext.disconnect(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.disconnect
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the disconnect operation is madefuture
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void close(ChannelHandlerContext ctx, ChannelPromise future) throws Exception
ChannelHandlerContext.close(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.close
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the close operation is madefuture
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void deregister(ChannelHandlerContext ctx, ChannelPromise future) throws Exception
ChannelHandlerContext.close(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.deregister
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the close operation is madefuture
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void read(ChannelHandlerContext ctx) throws Exception
ChannelHandlerContext.read()
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.read
in interface ChannelOutboundHandler
Exception
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
ChannelHandlerContext.write(Object, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.write
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- the ChannelPromise
to notify once the operation completesException
- thrown if an error accourpublic void flush(ChannelHandlerContext ctx) throws Exception
ChannelHandlerContext.flush()
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.flush
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the flush operation is madeException
- thrown if an error accourCopyright © 2008–2015 The Netty Project. All rights reserved.