You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/04/01 15:46:07 UTC

svn commit: r760890 - /camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java

Author: davsclaus
Date: Wed Apr  1 13:46:01 2009
New Revision: 760890

URL: http://svn.apache.org/viewvc?rev=760890&view=rev
Log:
Mina - use a timeout for writing to mina in case mina is hanging, otherwise we will hang forever. The client will get an exception anyway that the write failed.

Modified:
    camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java

Modified: camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java?rev=760890&r1=760889&r2=760890&view=diff
==============================================================================
--- camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java (original)
+++ camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaHelper.java Wed Apr  1 13:46:01 2009
@@ -46,7 +46,8 @@
     public static void writeBody(IoSession session, Object body, Exchange exchange) throws CamelExchangeException {
         // the write operation is asynchronous. Use WriteFuture to wait until the session has been written
         WriteFuture future = session.write(body);
-        future.join();
+        // must use a timeout (we use 10s) as in some very high performance scenarious a write can cause thred hanging forever
+        future.join(10 * 1000L);
         if (!future.isWritten()) {
             LOG.warn("Cannot write body: " + body + " using session: " + session);
             throw new CamelExchangeException("Cannot write body", exchange);