Channel
ChannelInboundHandler which offers an easy way to initialize a Channel once it was
registered to its EventLoop.
Implementations are most often used in the context of Bootstrap#handler(ChannelHandler) ,
ServerBootstrap#handler(ChannelHandler) and ServerBootstrap#childHandler(ChannelHandler) to
setup the ChannelPipeline of a Channel.
public class MyChannelInitializer extendsBe aware that this class is marked asChannelInitializer{ public void initChannel(Channelchannel) { channel.pipeline().addLast("myHandler", new MyHandler()); } }ServerBootstrapbootstrap = ...; ... bootstrap.childHandler(new MyChannelInitializer()); ...
Sharable and so the implementation must be safe to be re-used.
| Modifier and Type | Field and Description |
|---|---|
| private final Set | |
| private static final InternalLogger |
| Access | Constructor and Description |
|---|---|
| public |
| initMap | back to summary |
|---|---|
| private final Set<ChannelHandlerContext> initMap | |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| ChannelInitializer | back to summary |
|---|---|
| public ChannelInitializer() | |
| channelRegistered | back to summary |
|---|---|
| public final void channelRegistered(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| exceptionCaught | back to summary |
|---|---|
| public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception Overrides io. Implements io. Handle the
| |
| handlerAdded | back to summary |
|---|---|
| public void handlerAdded(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| initChannel | back to summary |
|---|---|
| protected abstract void initChannel(C ch) throws Exception This method will be called once the
| |
| initChannel | back to summary |
|---|---|
private boolean initChannel(ChannelHandlerContext ctx) throws Exception
| |
| removeState | back to summary |
|---|---|
| private void removeState(final ChannelHandlerContext ctx) | |