Repository: camel
Updated Branches:
  refs/heads/master e04347b56 -> 672e2b15c


CAMEL-9514 Fixed the issue that camel-netty4 maximumPoolSize option is ignored


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

Branch: refs/heads/master
Commit: 672e2b15c0a286ede1a7b32a761909d0379509dd
Parents: e04347b
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Mon Jan 18 09:00:35 2016 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Mon Jan 18 09:00:35 2016 +0800

----------------------------------------------------------------------
 .../camel/component/netty4/NettyComponent.java  | 24 ++++++++++++++++----
 .../component/netty4/NettyConfiguration.java    | 13 -----------
 2 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/672e2b15/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
index 4fc7b75..4cb70be 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
@@ -32,6 +32,7 @@ import org.apache.camel.util.concurrent.CamelThreadFactory;
 
 public class NettyComponent extends UriEndpointComponent {
     private NettyConfiguration configuration;
+    private int maximumPoolSize = 16;
     private volatile EventExecutorGroup executorService;
 
     public NettyComponent() {
@@ -46,6 +47,19 @@ public class NettyComponent extends UriEndpointComponent {
         super(context, NettyEndpoint.class);
     }
 
+    public int getMaximumPoolSize() {
+        return maximumPoolSize;
+    }
+
+    /**
+     * The thread pool size for the EventExecutorGroup if its in use.
+     * <p/>
+     * The default value is 16.
+     */
+    public void setMaximumPoolSize(int maximumPoolSize) {
+        this.maximumPoolSize = maximumPoolSize;
+    }
+
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         NettyConfiguration config;
@@ -124,18 +138,18 @@ public class NettyComponent extends UriEndpointComponent {
         // we should use a shared thread pool as recommended by Netty
         String pattern = 
getCamelContext().getExecutorServiceManager().getThreadNamePattern();
         ThreadFactory factory = new CamelThreadFactory(pattern, 
"NettyEventExecutorGroup", true);
-        return new 
DefaultEventExecutorGroup(configuration.getMaximumPoolSize(), factory);
+        return new DefaultEventExecutorGroup(getMaximumPoolSize(), factory);
     }
 
     @Override
     protected void doStop() throws Exception {
-
-        if (executorService != null) {
-            
getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
+        //Only shutdown the executorService if it is create by netty component
+        if (configuration.isUsingExecutorService() && executorService != null) 
{
+            
getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService);
             executorService = null;
         }
 
         super.doStop();
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/672e2b15/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
index 7f33e39..cf8dac1 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
@@ -84,8 +84,6 @@ public class NettyConfiguration extends 
NettyServerBootstrapConfiguration implem
     private boolean allowDefaultCodec = true;
     @UriParam(label = "producer,advanced")
     private ClientInitializerFactory clientInitializerFactory;
-    @UriParam(label = "consumer,advanced", defaultValue = "16")
-    private int maximumPoolSize = 16;
     @UriParam(label = "consumer,advanced", defaultValue = "true")
     private boolean usingExecutorService = true;
     @UriParam(label = "producer,advanced", defaultValue = "-1")
@@ -507,17 +505,6 @@ public class NettyConfiguration extends 
NettyServerBootstrapConfiguration implem
         this.clientInitializerFactory = clientInitializerFactory;
     }
 
-    public int getMaximumPoolSize() {
-        return maximumPoolSize;
-    }
-
-    /**
-     * The core pool size for the ordered thread pool, if its in use.
-     */
-    public void setMaximumPoolSize(int maximumPoolSize) {
-        this.maximumPoolSize = maximumPoolSize;
-    }
-
     public boolean isUsingExecutorService() {
         return usingExecutorService;
     }

Reply via email to