From 0e4c80b95360e39cef89bb2a4eaa5d3adf89ffe9 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 13 Feb 2014 19:44:40 -0800 Subject: [PATCH] Fix IllegalStateException caused by ChannelHandlerAppender --- .../java/io/netty/channel/ChannelHandlerAppender.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/ChannelHandlerAppender.java b/transport/src/main/java/io/netty/channel/ChannelHandlerAppender.java index ee84d3c97b..2ddf769a6b 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandlerAppender.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandlerAppender.java @@ -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) {