CAMEL-7391: camel-netty - NettyProducer need to use its own timer, due netty issue https://github.com/netty/netty/issues/2424
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e6ff4ffa Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e6ff4ffa Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e6ff4ffa Branch: refs/heads/camel-2.12.x Commit: e6ff4ffa133302000c6a6f008a054b24bae93095 Parents: 8fa0c9f Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Apr 24 16:08:58 2014 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Apr 24 16:10:13 2014 +0200 ---------------------------------------------------------------------- .../org/apache/camel/component/netty/NettyProducer.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e6ff4ffa/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 f0758c8..50de736 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 @@ -51,6 +51,8 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory; import org.jboss.netty.channel.socket.nio.NioDatagramWorkerPool; import org.jboss.netty.channel.socket.nio.WorkerPool; +import org.jboss.netty.util.HashedWheelTimer; +import org.jboss.netty.util.Timer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +68,7 @@ public class NettyProducer extends DefaultAsyncProducer { private BossPool bossPool; private WorkerPool workerPool; private ObjectPool<Channel> pool; + private Timer timer; public NettyProducer(NettyEndpoint nettyEndpoint, NettyConfiguration configuration) { super(nettyEndpoint); @@ -123,6 +126,8 @@ public class NettyProducer extends DefaultAsyncProducer { } } + timer = new HashedWheelTimer(); + // setup pipeline factory ClientPipelineFactory factory = configuration.getClientPipelineFactory(); if (factory != null) { @@ -175,6 +180,11 @@ public class NettyProducer extends DefaultAsyncProducer { pool = null; } + if (timer != null) { + timer.stop(); + timer = null; + } + super.doStop(); } @@ -327,7 +337,7 @@ public class NettyProducer extends DefaultAsyncProducer { if (bp == null) { // create new pool which we should shutdown when stopping as its not shared bossPool = new NettyClientBossPoolBuilder() - .withTimer(getEndpoint().getTimer()) + .withTimer(timer) .withBossCount(configuration.getBossCount()) .withName("NettyClientTCPBoss") .build();