You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2016/01/18 04:07:20 UTC
[1/3] camel git commit: CAMEL-9514 Fixed the issue that camel-netty4
maximumPoolSize option is ignored
Repository: camel
Updated Branches:
refs/heads/camel-2.16.x 0aba642a6 -> 30a9732f8
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/1a47d3a1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1a47d3a1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1a47d3a1
Branch: refs/heads/camel-2.16.x
Commit: 1a47d3a127d9ceb0e3dba2904f18e5af0d375d6c
Parents: 0aba642
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Jan 18 09:00:35 2016 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Jan 18 09:52:33 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/1a47d3a1/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/1a47d3a1/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;
}
[3/3] camel git commit: Using the port property in
NettyHttpCompressTest
Posted by ni...@apache.org.
Using the port property in NettyHttpCompressTest
Conflicts:
components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/30a9732f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/30a9732f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/30a9732f
Branch: refs/heads/camel-2.16.x
Commit: 30a9732f8c2c873df1a9554a40d08637e65e40d4
Parents: 34707b2
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Jan 18 09:13:52 2016 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Jan 18 11:06:41 2016 +0800
----------------------------------------------------------------------
.../component/netty4/http/NettyHttpCompressTest.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/30a9732f/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java
index 1697c75..a0acb9f 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpCompressTest.java
@@ -30,7 +30,7 @@ import org.apache.camel.impl.JndiRegistry;
import org.junit.Test;
public class NettyHttpCompressTest extends BaseNettyTest {
-
+
// setup the decompress decoder here
@Override
protected JndiRegistry createRegistry() throws Exception {
@@ -40,22 +40,22 @@ public class NettyHttpCompressTest extends BaseNettyTest {
registry.bind("myDecoders", decoders);
return registry;
}
-
+
@Test
public void testContentType() throws Exception {
-
+
byte[] data = "Hello World".getBytes(Charset.forName("UTF-8"));
Map<String, Object> headers = new HashMap<String, Object>();
headers.put("content-type", "text/plain; charset=\"UTF-8\"");
headers.put("Accept-Encoding", "compress, gzip");
- String out = template.requestBodyAndHeaders("netty4-http:http://0.0.0.0:9001/foo?decoders=#myDecoders", data,
+ String out = template.requestBodyAndHeaders("netty4-http:http://localhost:{{port}}/foo?decoders=#myDecoders", data,
headers, String.class);
// The decoded out has some space to clean up.
assertEquals("Bye World", out.trim());
-
-
+
+
}
@Override
@@ -63,7 +63,7 @@ public class NettyHttpCompressTest extends BaseNettyTest {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("netty4-http:http://0.0.0.0:9001/foo?compression=true")
+ from("netty4-http:http://0.0.0.0:{{port}}/foo?compression=true")
.transform().constant("Bye World").setHeader("content-type").constant("text/plain; charset=\"UTF-8\"");
}
};
[2/3] camel git commit: CAMEL-9514 Cleaned up the comments
Posted by ni...@apache.org.
CAMEL-9514 Cleaned up the comments
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/34707b23
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/34707b23
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/34707b23
Branch: refs/heads/camel-2.16.x
Commit: 34707b23b36124f7849b5f98cb0f162ee75ab3a0
Parents: 1a47d3a
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Jan 18 09:03:24 2016 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Jan 18 09:52:39 2016 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/netty4/NettyComponent.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/34707b23/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 4cb70be..048d054 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
@@ -124,7 +124,8 @@ public class NettyComponent extends UriEndpointComponent {
if (configuration == null) {
configuration = new NettyConfiguration();
}
-
+
+ //Only setup the executorService if it is needed
if (configuration.isUsingExecutorService() && executorService == null) {
executorService = createExecutorService();
}
@@ -143,7 +144,7 @@ public class NettyComponent extends UriEndpointComponent {
@Override
protected void doStop() throws Exception {
- //Only shutdown the executorService if it is create by netty component
+ //Only shutdown the executorService if it is created by netty component
if (configuration.isUsingExecutorService() && executorService != null) {
getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService);
executorService = null;