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 2014/06/16 15:29:46 UTC

[2/2] git commit: CAMEL-7500 updated the state of exceptionHandled to avoid the callback be called twice when the ChannelClosedException is thrown.

CAMEL-7500 updated the state of exceptionHandled to avoid the callback be called twice when the ChannelClosedException is thrown.


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

Branch: refs/heads/camel-2.12.x
Commit: a52183e5f0f0d95810aea9b9021bc1b578293013
Parents: 265c289
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Jun 16 11:03:27 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Jun 16 21:29:16 2014 +0800

----------------------------------------------------------------------
 .../camel/component/netty/handlers/ClientChannelHandler.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a52183e5/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 c9f997f..e0ddb9f 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
@@ -62,8 +62,8 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
     public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent exceptionEvent) throws Exception {
         if (LOG.isTraceEnabled()) {
             LOG.trace("Exception caught at Channel: " + ctx.getChannel(), exceptionEvent.getCause());
-
         }
+         
         if (exceptionHandled) {
             // ignore subsequent exceptions being thrown
             return;
@@ -108,6 +108,8 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
         producer.getAllChannels().remove(ctx.getChannel());
 
         if (producer.getConfiguration().isSync() && !messageReceived && !exceptionHandled) {
+            // To avoid call the callback.done twice 
+            exceptionHandled = true;
             // session was closed but no message received. This could be because the remote server had an internal error
             // and could not return a response. We should count down to stop waiting for a response
             if (LOG.isDebugEnabled()) {