Author: davsclaus
Date: Mon Apr  9 15:53:17 2012
New Revision: 1311290

URL: http://svn.apache.org/viewvc?rev=1311290&view=rev
Log:
CAMEL-5150: Some cleanup in camel-netty according to Netty docs.

Modified:
    
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java

Modified: 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java?rev=1311290&r1=1311289&r2=1311290&view=diff
==============================================================================
--- 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
 (original)
+++ 
camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
 Mon Apr  9 15:53:17 2012
@@ -252,14 +252,22 @@ public class NettyProducer extends Defau
         if (channelFactory == null) {
             bossExecutor = 
context.getExecutorServiceManager().newCachedThreadPool(this, "NettyTCPBoss");
             workerExecutor = 
context.getExecutorServiceManager().newCachedThreadPool(this, "NettyTCPWorker");
-            channelFactory = new NioClientSocketChannelFactory(bossExecutor, 
workerExecutor);
+            if (configuration.getWorkerCount() <= 0) {
+                channelFactory = new 
NioClientSocketChannelFactory(bossExecutor, workerExecutor);
+            } else {
+                channelFactory = new 
NioClientSocketChannelFactory(bossExecutor, workerExecutor, 
configuration.getWorkerCount());
+            }
         }
     }
 
     protected void setupUDPCommunication() throws Exception {
         if (datagramChannelFactory == null) {
             workerExecutor = 
context.getExecutorServiceManager().newCachedThreadPool(this, "NettyUDPWorker");
-            datagramChannelFactory = new 
NioDatagramChannelFactory(workerExecutor);
+            if (configuration.getWorkerCount() <= 0) {
+                datagramChannelFactory = new 
NioDatagramChannelFactory(workerExecutor);
+            } else {
+                datagramChannelFactory = new 
NioDatagramChannelFactory(workerExecutor, configuration.getWorkerCount());
+            }
         }
     }
 


Reply via email to