camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] git commit: CAMEL-6730: Fixed requestTimeout on camel-netty.
Date Wed, 18 Sep 2013 09:20:49 GMT
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/a84da605
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a84da605
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a84da605

Branch: refs/heads/camel-2.11.x
Commit: a84da605171cd87b7c7e52b5a1b294d7e0f3aafa
Parents: 6903447
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Sep 18 11:18:05 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Sep 18 11:20:02 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/camel/blob/a84da605/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 cd2f272..c58075b 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);
 


Mime
View raw message