Updated Branches: refs/heads/master aeecd80ec -> 858453c35
CAMEL-6921 Find another way to fix the NPE issue Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/858453c3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/858453c3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/858453c3 Branch: refs/heads/master Commit: 858453c3578eb470a0513d35007d038239ff2d9e Parents: aeecd80 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Fri Jan 17 10:57:43 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Fri Jan 17 10:58:49 2014 +0800 ---------------------------------------------------------------------- .../java/org/apache/camel/component/netty/NettyProducer.java | 3 ++- .../camel/component/netty/handlers/ClientChannelHandler.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/858453c3/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java index 2b5faba..1b0a7a7 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java @@ -514,7 +514,8 @@ public class NettyProducer extends DefaultAsyncProducer { @Override public void destroyObject(Channel channel) throws Exception { LOG.trace("Destroying channel: {}", channel); - // noop + NettyHelper.close(channel); + ALL_CHANNELS.remove(channel); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/858453c3/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java index 3d58471..c9f997f 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java @@ -136,6 +136,10 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler { } Exchange exchange = getExchange(ctx); + if (exchange == null) { + // we just ignore the received message as the channel is closed + return; + } AsyncCallback callback = getAsyncCallback(ctx); Message message;