CAMEL-7391: camel-netty - NettyProduce should use timer from component instead of creating new timer per producer
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8fa0c9f7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8fa0c9f7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8fa0c9f7 Branch: refs/heads/camel-2.12.x Commit: 8fa0c9f738febc6ad6bc6351e64d1b1327dec8a4 Parents: 8fe99ba Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Apr 24 15:42:58 2014 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Apr 24 15:44:18 2014 +0200 ---------------------------------------------------------------------- .../component/netty/NettyClientBossPoolBuilder.java | 14 ++++++++++++-- .../apache/camel/component/netty/NettyProducer.java | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8fa0c9f7/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyClientBossPoolBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyClientBossPoolBuilder.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyClientBossPoolBuilder.java index 76bd3f9..1b9bee2 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyClientBossPoolBuilder.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyClientBossPoolBuilder.java @@ -20,7 +20,7 @@ import java.util.concurrent.Executors; import org.jboss.netty.channel.socket.nio.BossPool; import org.jboss.netty.channel.socket.nio.NioClientBossPool; -import org.jboss.netty.util.HashedWheelTimer; +import org.jboss.netty.util.Timer; /** * A builder to create Netty {@link org.jboss.netty.channel.socket.nio.BossPool} which can be used for sharing boos pools @@ -31,6 +31,7 @@ public final class NettyClientBossPoolBuilder { private String name = "NettyClientBoss"; private String pattern; private int bossCount = 1; + private Timer timer; public void setName(String name) { this.name = name; @@ -44,6 +45,10 @@ public final class NettyClientBossPoolBuilder { this.bossCount = bossCount; } + public void setTimer(Timer timer) { + this.timer = timer; + } + public NettyClientBossPoolBuilder withName(String name) { setName(name); return this; @@ -59,10 +64,15 @@ public final class NettyClientBossPoolBuilder { return this; } + public NettyClientBossPoolBuilder withTimer(Timer timer) { + setTimer(timer); + return this; + } + /** * Creates a new boss pool. */ BossPool build() { - return new NioClientBossPool(Executors.newCachedThreadPool(), bossCount, new HashedWheelTimer(), new CamelNettyThreadNameDeterminer(pattern, name)); + return new NioClientBossPool(Executors.newCachedThreadPool(), bossCount, timer, new CamelNettyThreadNameDeterminer(pattern, name)); } } http://git-wip-us.apache.org/repos/asf/camel/blob/8fa0c9f7/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 9e318d3..f0758c8 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 @@ -327,6 +327,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()) .withBossCount(configuration.getBossCount()) .withName("NettyClientTCPBoss") .build();