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/8b5dddf3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b5dddf3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b5dddf3 Branch: refs/heads/camel-2.13.x Commit: 8b5dddf38c2fb610ea9a7a69f481914dc0d9b7bc Parents: ce489dc 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:09:27 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/8b5dddf3/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();