public class ChannelHandlerAppender extends ChannelInboundHandlerAdapter
ChannelHandler
that appends the specified ChannelHandler
s right next to itself.
By default, it removes itself from the ChannelPipeline
once the specified ChannelHandler
s
are added. Optionally, you can keep it in the ChannelPipeline
by specifying a boolean
parameter at construction time.ChannelHandler.Sharable
Modifier | Constructor and Description |
---|---|
protected |
ChannelHandlerAppender()
Creates a new uninitialized instance.
|
protected |
ChannelHandlerAppender(boolean selfRemoval)
Creates a new uninitialized instance.
|
|
ChannelHandlerAppender(boolean selfRemoval,
ChannelHandler... handlers)
Creates a new instance that appends the specified
ChannelHandler s right next to itself. |
|
ChannelHandlerAppender(boolean selfRemoval,
Iterable<? extends ChannelHandler> handlers)
Creates a new instance that appends the specified
ChannelHandler s right next to itself. |
|
ChannelHandlerAppender(ChannelHandler... handlers)
Creates a new instance that appends the specified
ChannelHandler s right next to itself. |
|
ChannelHandlerAppender(Iterable<? extends ChannelHandler> handlers)
Creates a new instance that appends the specified
ChannelHandler s right next to itself. |
Modifier and Type | Method and Description |
---|---|
protected ChannelHandlerAppender |
add(ChannelHandler... handlers)
Adds the specified handlers to the list of the appended handlers.
|
protected ChannelHandlerAppender |
add(ChannelHandler handler)
Adds the specified handler to the list of the appended handlers with the auto-generated handler name.
|
protected ChannelHandlerAppender |
add(Iterable<? extends ChannelHandler> handlers)
Adds the specified handlers to the list of the appended handlers.
|
protected ChannelHandlerAppender |
add(String name,
ChannelHandler handler)
Adds the specified handler to the list of the appended handlers.
|
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
protected <T extends ChannelHandler> |
handlerAt(int index)
Returns the
index -th appended handler. |
channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
protected ChannelHandlerAppender()
add(ChannelHandler...)
before adding this handler into a ChannelPipeline
.protected ChannelHandlerAppender(boolean selfRemoval)
add(ChannelHandler...)
before adding this handler into a ChannelPipeline
.selfRemoval
- true
to remove itself from the ChannelPipeline
after appending
the ChannelHandler
s specified via add(ChannelHandler...)
.public ChannelHandlerAppender(Iterable<? extends ChannelHandler> handlers)
ChannelHandler
s right next to itself.public ChannelHandlerAppender(ChannelHandler... handlers)
ChannelHandler
s right next to itself.public ChannelHandlerAppender(boolean selfRemoval, Iterable<? extends ChannelHandler> handlers)
ChannelHandler
s right next to itself.selfRemoval
- true
to remove itself from the ChannelPipeline
after appending
the specified ChannelHandler
spublic ChannelHandlerAppender(boolean selfRemoval, ChannelHandler... handlers)
ChannelHandler
s right next to itself.selfRemoval
- true
to remove itself from the ChannelPipeline
after appending
the specified ChannelHandler
sprotected final ChannelHandlerAppender add(String name, ChannelHandler handler)
name
- the name of the appended handler. null
to auto-generatehandler
- the handler to appendIllegalStateException
- if ChannelHandlerAppender
has been added to the pipeline alreadyprotected final ChannelHandlerAppender add(ChannelHandler handler)
handler
- the handler to appendIllegalStateException
- if ChannelHandlerAppender
has been added to the pipeline alreadyprotected final ChannelHandlerAppender add(Iterable<? extends ChannelHandler> handlers)
IllegalStateException
- if ChannelHandlerAppender
has been added to the pipeline alreadyprotected final ChannelHandlerAppender add(ChannelHandler... handlers)
IllegalStateException
- if ChannelHandlerAppender
has been added to the pipeline alreadyprotected final <T extends ChannelHandler> T handlerAt(int index)
index
-th appended handler.public void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapter
handlerAdded
in interface ChannelHandler
handlerAdded
in class ChannelHandlerAdapter
Exception
Copyright © 2008–2015 The Netty Project. All rights reserved.