Repository: camel Updated Branches: refs/heads/camel-2.14.x 2637d5b49 -> 77e7aa258 refs/heads/camel-2.15.x 30d3dca11 -> c6cfb4b07
CAMEL-8702 doesn't create the a new EventLoopGroup per connection in NettyProducer Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/77e7aa25 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/77e7aa25 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/77e7aa25 Branch: refs/heads/camel-2.14.x Commit: 77e7aa2584ed853eedcd3bfa555c26ef1a0e17c1 Parents: 2637d5b Author: Willem Jiang <willem.ji...@gmail.com> Authored: Mon Apr 27 10:55:34 2015 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Mon Apr 27 10:57:02 2015 +0800 ---------------------------------------------------------------------- .../apache/camel/component/netty4/NettyProducer.java | 14 ++++++-------- .../netty4/NettyServerBootstrapConfiguration.java | 12 +++++++++++- 2 files changed, 17 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/77e7aa25/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java index 11f8b55..c764181 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java @@ -93,7 +93,12 @@ public class NettyProducer extends DefaultAsyncProducer { @Override protected void doStart() throws Exception { super.doStart(); - + if (configuration.getWorkerGroup() == null) { + // create new pool which we should shutdown when stopping as its not shared + workerGroup = new NettyWorkerPoolBuilder().withWorkerCount(configuration.getWorkerCount()) + .withName("NettyClientTCPWorker").build(); + } + if (configuration.isProducerPoolEnabled()) { // setup pool where we want an unbounded pool, which allows the pool to shrink on no demand GenericObjectPool.Config config = new GenericObjectPool.Config(); @@ -314,19 +319,12 @@ public class NettyProducer extends DefaultAsyncProducer { } protected EventLoopGroup getWorkerGroup() { - // prefer using explicit configured thread pools EventLoopGroup wg = configuration.getWorkerGroup(); - if (wg == null) { - // create new pool which we should shutdown when stopping as its not - // shared - workerGroup = new NettyWorkerPoolBuilder().withWorkerCount(configuration.getWorkerCount()) - .withName("NettyClientTCPWorker").build(); wg = workerGroup; } return wg; - } protected ChannelFuture openConnection() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/77e7aa25/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java index e4f7737..a071535 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java @@ -57,7 +57,9 @@ public class NettyServerBootstrapConfiguration implements Cloneable { protected String securityProvider; protected String enabledProtocols = defaultEnabledProtocols; protected String passphrase; + @UriParam protected EventLoopGroup bossGroup; + @UriParam protected EventLoopGroup workerGroup; protected String networkInterface; @@ -320,14 +322,22 @@ public class NettyServerBootstrapConfiguration implements Cloneable { return bossGroup; } + /** + * Set the BossGroup which could be used for handling the new connection of the server side across the NettyEndpoint + * @param bossGroup + */ public void setBossGroup(EventLoopGroup bossGroup) { this.bossGroup = bossGroup; } - + public EventLoopGroup getWorkerGroup() { return workerGroup; } + /** + * Set the WorkerGroup which could be used for handling selector eventloop across the NettyEndpoint + * @param workerGroup + */ public void setWorkerGroup(EventLoopGroup workerGroup) { this.workerGroup = workerGroup; }