public class CombinedChannelDuplexHandler<I extends ChannelInboundHandler,O extends ChannelOutboundHandler> extends ChannelDuplexHandler
ChannelHandler.Sharable
限定符 | 构造器和说明 |
---|---|
protected |
CombinedChannelDuplexHandler()
Creates a new uninitialized instance.
|
|
CombinedChannelDuplexHandler(I inboundHandler,
O outboundHandler)
Creates a new instance that combines the specified two handlers into one.
|
ensureNotSharable, isSharable
protected CombinedChannelDuplexHandler()
init(ChannelInboundHandler, ChannelOutboundHandler)
before adding this handler into a
ChannelPipeline
.protected final void init(I inboundHandler, O outboundHandler)
java.lang.IllegalStateException
- if this handler was not constructed via the default constructor or
if this handler does not implement all required handler interfacesjava.lang.IllegalArgumentException
- if the specified handlers cannot be combined into one due to a conflict
in the type hierarchyprotected final I inboundHandler()
protected final O outboundHandler()
public final void removeInboundHandler()
ChannelInboundHandler
that was combined in this CombinedChannelDuplexHandler
.public final void removeOutboundHandler()
ChannelOutboundHandler
that was combined in this CombinedChannelDuplexHandler
.public void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerAdded
在接口中 ChannelHandler
handlerAdded
在类中 ChannelHandlerAdapter
java.lang.Exception
public void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerRemoved
在接口中 ChannelHandler
handlerRemoved
在类中 ChannelHandlerAdapter
java.lang.Exception
public void channelRegistered(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRegistered()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelRegistered
在接口中 ChannelInboundHandler
channelRegistered
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelUnregistered(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelUnregistered()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelUnregistered
在接口中 ChannelInboundHandler
channelUnregistered
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelActive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelActive()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelActive
在接口中 ChannelInboundHandler
channelActive
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelInactive()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelInactive
在接口中 ChannelInboundHandler
channelInactive
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireExceptionCaught(Throwable)
to forward
to the next ChannelHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.exceptionCaught
在接口中 ChannelHandler
exceptionCaught
在接口中 ChannelInboundHandler
exceptionCaught
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void userEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireUserEventTriggered(Object)
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.userEventTriggered
在接口中 ChannelInboundHandler
userEventTriggered
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRead(Object)
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelRead
在接口中 ChannelInboundHandler
channelRead
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelReadComplete(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelReadComplete()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelReadComplete
在接口中 ChannelInboundHandler
channelReadComplete
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelWritabilityChanged()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelWritabilityChanged
在接口中 ChannelInboundHandler
channelWritabilityChanged
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
public void bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.bind(SocketAddress, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.bind
在接口中 ChannelOutboundHandler
bind
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the bind operation is madelocalAddress
- the SocketAddress
to which it should boundpromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void connect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.connect
在接口中 ChannelOutboundHandler
connect
在类中 ChannelDuplexHandler
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 connectpromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.disconnect(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.disconnect
在接口中 ChannelOutboundHandler
disconnect
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the disconnect operation is madepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.close(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.close
在接口中 ChannelOutboundHandler
close
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the close operation is madepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.deregister(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.deregister
在接口中 ChannelOutboundHandler
deregister
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the close operation is madepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void read(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelDuplexHandler
ChannelHandlerContext.read()
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.read
在接口中 ChannelOutboundHandler
read
在类中 ChannelDuplexHandler
java.lang.Exception
public void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandler
ChannelOutboundInvoker.write(Object, ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.write
在接口中 ChannelOutboundHandler
write
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void flush(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelDuplexHandler
ChannelHandlerContext.flush()
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.flush
在接口中 ChannelOutboundHandler
flush
在类中 ChannelDuplexHandler
ctx
- the ChannelHandlerContext
for which the flush operation is madejava.lang.Exception
- thrown if an error occurs