Repository: camel Updated Branches: refs/heads/camel-2.12.x 265c28992 -> a52183e5f refs/heads/camel-2.13.x c98d04305 -> 698343e1b
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/698343e1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/698343e1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/698343e1 Branch: refs/heads/camel-2.13.x Commit: 698343e1b0ab35121848442ee520f8c118696dc8 Parents: c98d043 Author: Willem Jiang <[email protected]> Authored: Mon Jun 16 11:03:27 2014 +0800 Committer: Willem Jiang <[email protected]> Committed: Mon Jun 16 21:28:37 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/698343e1/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()) {
