CAMEL-7915 Share the HashedWheelTimer across the Camel NettyComponent
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3fa18575
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3fa18575
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3fa18575
Branch: refs/remotes/origin/camel-2.13.x
Commit: 3fa185751fdfe428d52072a50197aaecff2636b9
Parents: 5fbd945
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Fri Oct 17 16:20:21 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Fri Oct 17 16:26:46 2014 +0800
----------------------------------------------------------------------
.../apache/camel/component/netty/NettyProducer.java | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3fa18575/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 87ad2be..7be6a21 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,8 +51,6 @@ 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;
@@ -68,7 +66,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);
@@ -126,8 +124,6 @@ public class NettyProducer extends DefaultAsyncProducer {
}
}
- timer = new HashedWheelTimer();
-
// setup pipeline factory
ClientPipelineFactory factory = configuration.getClientPipelineFactory();
if (factory != null) {
@@ -180,11 +176,6 @@ public class NettyProducer extends DefaultAsyncProducer {
pool = null;
}
- if (timer != null) {
- timer.stop();
- timer = null;
- }
-
super.doStop();
}
@@ -337,7 +328,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(timer)
+ .withTimer(getEndpoint().getTimer())
.withBossCount(configuration.getBossCount())
.withName("NettyClientTCPBoss")
.build();
|