Fix IllegalStateException caused by ChannelHandlerAppender

This commit is contained in:
Trustin Lee 2014-02-13 19:44:40 -08:00
parent abcb39b638
commit 0e4c80b953

View File

@ -181,9 +181,9 @@ public class ChannelHandlerAppender extends ChannelInboundHandlerAdapter {
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
added = true;
DefaultChannelPipeline pipeline = (DefaultChannelPipeline) ctx.pipeline();
String name = ctx.name();
DefaultChannelHandlerContext dctx = (DefaultChannelHandlerContext) ctx;
DefaultChannelPipeline pipeline = (DefaultChannelPipeline) dctx.pipeline();
String name = dctx.name();
try {
for (Entry e: handlers) {
String oldName = name;
@ -192,7 +192,7 @@ public class ChannelHandlerAppender extends ChannelInboundHandlerAdapter {
} else {
name = e.name;
}
pipeline.addAfter(ctx.executor(), oldName, name, e.handler);
pipeline.addAfter(dctx.executor, oldName, name, e.handler);
}
} finally {
if (selfRemoval) {