Updated Branches:
  refs/heads/camel-2.11.x 690344774 -> 79be93274
  refs/heads/camel-2.12.x 111ba6a6b -> f63a7698a
  refs/heads/master 053437df4 -> f10041566


CAMEL-6730: Fixed requestTimeout on camel-netty.


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

Branch: refs/heads/master
Commit: cc99d3e82531fe0c538ca6fde20b3e14b01634a6
Parents: 053437d
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Sep 18 11:18:05 2013 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Sep 18 11:18:05 2013 +0200

----------------------------------------------------------------------
 .../netty/handlers/ClientChannelHandler.java         | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cc99d3e8/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
 
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index b55f4b7..b830c95 100644
--- 
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ 
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.netty.handlers;
 
+import java.util.List;
+
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
@@ -26,11 +28,13 @@ import org.apache.camel.component.netty.NettyHelper;
 import org.apache.camel.component.netty.NettyPayloadHelper;
 import org.apache.camel.component.netty.NettyProducer;
 import org.apache.camel.util.ExchangeHelper;
+import org.jboss.netty.channel.ChannelHandler;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.ChannelStateEvent;
 import org.jboss.netty.channel.ExceptionEvent;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -120,17 +124,20 @@ public class ClientChannelHandler extends 
SimpleChannelUpstreamHandler {
 
     @Override
     public void messageReceived(ChannelHandlerContext ctx, MessageEvent 
messageEvent) throws Exception {
+        messageReceived = true;
+
         if (LOG.isTraceEnabled()) {
             LOG.trace("Message received: {}", messageEvent);
         }
 
         if (producer.getConfiguration().getRequestTimeout() > 0) {
-            LOG.trace("Removing timeout channel as we received message");
-            ctx.getPipeline().remove("timeout");
+            ChannelHandler handler = ctx.getPipeline().get("timeout");
+            if (handler != null) {
+                LOG.trace("Removing timeout channel as we received message");
+                ctx.getPipeline().remove(handler);
+            }
         }
 
-        messageReceived = true;
-
         Exchange exchange = getExchange(ctx);
         AsyncCallback callback = getAsyncCallback(ctx);
 

Reply via email to