Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9B99F10B15 for ; Thu, 14 Nov 2013 21:03:56 +0000 (UTC) Received: (qmail 65512 invoked by uid 500); 14 Nov 2013 21:03:56 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 65450 invoked by uid 500); 14 Nov 2013 21:03:56 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 65443 invoked by uid 99); 14 Nov 2013 21:03:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 21:03:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 43B1682A389; Thu, 14 Nov 2013 21:03:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bvahdat@apache.org To: commits@camel.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: Polished. Date: Thu, 14 Nov 2013 21:03:56 +0000 (UTC) Updated Branches: refs/heads/camel-2.12.x f4e8d9aa0 -> a256e411f Polished. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a256e411 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a256e411 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a256e411 Branch: refs/heads/camel-2.12.x Commit: a256e411f9008a705d0f2371324d0491c28c11ef Parents: f4e8d9a Author: Babak Vahdat Authored: Thu Nov 14 21:58:49 2013 +0100 Committer: Babak Vahdat Committed: Thu Nov 14 22:00:36 2013 +0100 ---------------------------------------------------------------------- .../apache/camel/component/cxf/CxfEndpoint.java | 4 +--- .../apache/camel/component/mina/MinaHelper.java | 10 +++++----- .../apache/camel/component/mina2/Mina2Helper.java | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/a256e411/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java index 5e7e941..c63c1a2 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java @@ -951,9 +951,7 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy } if (elements != null && content.size() < elements.size()) { - LOG.warn("Cannot set right payload parameters. Please check the BindingOperation and PayLoadMessage."); - throw new IllegalArgumentException( - "The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage."); + throw new IllegalArgumentException("The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage."); } message.setContent(List.class, content); http://git-wip-us.apache.org/repos/asf/camel/blob/a256e411/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java index 7772759..f814995 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java @@ -35,7 +35,8 @@ public final class MinaHelper { } /** - * Writes the given body to MINA session. Will wait until the body has been written. + * Asynchronous writes the given body to MINA session. Will wait at most for + * 10 seconds until the body has been written. * * @param session the MINA session * @param body the body to write (send) @@ -48,11 +49,10 @@ public final class MinaHelper { WriteFuture future = session.write(body); // must use a timeout (we use 10s) as in some very high performance scenarios a write can cause // thread hanging forever - LOG.trace("Waiting for write to complete"); - future.join(10 * 1000L); + LOG.trace("Waiting for write to complete for body: {} using session: {}", body, session); + future.join(10000L); if (!future.isWritten()) { - LOG.warn("Cannot write body: " + body + " using session: " + session); - throw new CamelExchangeException("Cannot write body", exchange); + throw new CamelExchangeException("Cannot write body: " + body + " using session: " + session, exchange); } } http://git-wip-us.apache.org/repos/asf/camel/blob/a256e411/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java ---------------------------------------------------------------------- diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java index b25eab1..56ca48f 100644 --- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java +++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java @@ -18,6 +18,7 @@ package org.apache.camel.component.mina2; import org.apache.camel.CamelExchangeException; import org.apache.camel.Exchange; +import org.apache.mina.core.future.WriteFuture; import org.apache.mina.core.session.IoSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +35,8 @@ public final class Mina2Helper { } /** - * Writes the given body to MINA session. Will wait until the body has been written. + * Asynchronous writes the given body to MINA session. Will wait at most for + * 10 seconds until the body has been written. * * @param session the MINA session * @param body the body to write (send) @@ -42,9 +44,14 @@ public final class Mina2Helper { * @throws CamelExchangeException is thrown if the body could not be written for some reasons * (eg remote connection is closed etc.) */ - public static void writeBody(IoSession session, Object body, Exchange exchange) throws CamelExchangeException { - LOG.trace("write exchange [{}] with body [{}]", exchange, body); - // the write operation is asynchronous - session.write(body); + public static void writeBody(IoSession session, Object body, Exchange exchange) throws CamelExchangeException, InterruptedException { + // the write operation is asynchronous. Use WriteFuture to wait until the session has been written + WriteFuture future = session.write(body); + // must use a timeout (we use 10s) as in some very high performance scenarios a write can cause + // thread hanging forever + LOG.trace("Waiting for write to complete for body: {} using session: {}", body, session); + if (!future.awaitUninterruptibly(10000L)) { + throw new CamelExchangeException("Cannot write body: " + body + " using session: " + session, exchange); + } } }