Repository: camel Updated Branches: refs/heads/master d62ac0f4e -> bd4f8d1e8
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/bd4f8d1e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd4f8d1e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd4f8d1e Branch: refs/heads/master Commit: bd4f8d1e8e686e37ebfbd1c400e6d0a422a23ae9 Parents: f01a736 Author: Willem Jiang <[email protected]> Authored: Mon Jun 16 11:03:27 2014 +0800 Committer: Willem Jiang <[email protected]> Committed: Mon Jun 16 21:27:04 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/bd4f8d1e/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()) {
