Updated Branches:
  refs/heads/camel-2.12.x 4e6bab3bb -> 958fd9079
  refs/heads/master d16b5dced -> efbf31368


CAMEL-6894: camel-netty-http - Should use orderedThreadPoolExecutor


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

Branch: refs/heads/master
Commit: efbf31368e13563e5006dd4e0c00ac8a8a5701a3
Parents: d16b5dc
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Oct 24 14:33:31 2013 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Oct 24 14:33:41 2013 +0200

----------------------------------------------------------------------
 .../component/netty/http/HttpServerPipelineFactory.java  | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/efbf3136/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
 
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
index 8865fd3..2ae1794 100644
--- 
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
+++ 
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
@@ -32,6 +32,7 @@ import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
 import org.jboss.netty.handler.codec.http.HttpContentCompressor;
 import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
 import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
+import org.jboss.netty.handler.execution.ExecutionHandler;
 import org.jboss.netty.handler.ssl.SslHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -90,6 +91,16 @@ public class HttpServerPipelineFactory extends 
ServerPipelineFactory {
             pipeline.addLast("deflater", new HttpContentCompressor());
         }
 
+        if (consumer.getConfiguration().isOrderedThreadPoolExecutor()) {
+            // this must be added just before the 
HttpServerMultiplexChannelHandler
+            // use ordered thread pool, to ensure we process the events in 
order, and can send back
+            // replies in the expected order. eg this is required by TCP.
+            // and use a Camel thread factory so we have consistent thread 
namings
+            ExecutionHandler executionHandler = new 
ExecutionHandler(consumer.getEndpoint().getComponent().getExecutorService());
+            pipeline.addLast("executionHandler", executionHandler);
+            LOG.debug("Using OrderedMemoryAwareThreadPoolExecutor with core 
pool size: {}", consumer.getConfiguration().getMaximumPoolSize());
+        }
+
         int port = consumer.getConfiguration().getPort();
         ChannelHandler handler = 
consumer.getEndpoint().getComponent().getMultiplexChannelHandler(port).getChannelHandler();
         pipeline.addLast("handler", handler);

Reply via email to