Repository: camel
Updated Branches:
  refs/heads/master 376deb916 -> a47cee597


CAMEL-10184 - Allow to use a custom ChannelGroup for NettyProducer


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/687b906d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/687b906d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/687b906d

Branch: refs/heads/master
Commit: 687b906daea377af71141a73cc5421b080e63f38
Parents: 376deb9
Author: Jean-Yves BESSON <jean-yves.bes...@external.partecis.eu>
Authored: Thu Jul 28 17:14:55 2016 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Fri Jul 29 09:25:35 2016 +0200

----------------------------------------------------------------------
 .../apache/camel/component/netty4/NettyProducer.java    | 12 ++++++++++--
 .../netty4/NettyServerBootstrapConfiguration.java       |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/687b906d/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 e04452e..ca4ea84 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
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
 
 public class NettyProducer extends DefaultAsyncProducer {
     private static final Logger LOG = 
LoggerFactory.getLogger(NettyProducer.class);
-    private final ChannelGroup allChannels = new 
DefaultChannelGroup("NettyProducer", ImmediateEventExecutor.INSTANCE);
+    private ChannelGroup allChannels;
     private CamelContext context;
     private NettyConfiguration configuration;
     private ClientInitializerFactory pipelineFactory;
@@ -100,7 +100,7 @@ public class NettyProducer extends DefaultAsyncProducer {
                 .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();
@@ -136,6 +136,14 @@ public class NettyProducer extends DefaultAsyncProducer {
             pipelineFactory = new DefaultClientInitializerFactory(this);
         }
 
+        // setup channel group
+        if(configuration.getChannelGroup() == null) {
+            allChannels = new DefaultChannelGroup("NettyProducer", 
ImmediateEventExecutor.INSTANCE);
+        }
+        else {
+            allChannels = configuration.getChannelGroup();
+        }
+        
         if (!configuration.isLazyChannelCreation()) {
             // ensure the connection can be established when we start up
             Channel channel = pool.borrowObject();

http://git-wip-us.apache.org/repos/asf/camel/blob/687b906d/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 3972da5..6ccfb8b 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
@@ -99,7 +99,7 @@ public class NettyServerBootstrapConfiguration implements 
Cloneable {
     protected EventLoopGroup bossGroup;
     @UriParam(label = "consumer,advanced")
     protected EventLoopGroup workerGroup;
-    @UriParam(label = "consumer,advanced")
+    @UriParam(label = "advanced")
     protected ChannelGroup channelGroup;
     @UriParam(label = "consumer,advanced")
     protected String networkInterface;

Reply via email to