Hi,
When writing my ChannelInitializers, I try not to assume that I am the only ChannelInitializer in the pipeline. In other words, using constructs like ch.pipeline().addFirst() and addLast() may be detrimental, if there are other handlers already added to the pipeline.
My approach is currently to do:
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
String me = p.context(this).name();
p.addAfter(me, null, handler);
}
is there a better way to find precisely where this ChannelInitializer is in the pipeline, and add its handlers strictly after itself, but before any other handlers that may already be in the pipeline?
Thanks
Rogan