camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1355261 - /camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
Date Fri, 29 Jun 2012 08:18:46 GMT
Author: davsclaus
Date: Fri Jun 29 08:18:45 2012
New Revision: 1355261

URL: http://svn.apache.org/viewvc?rev=1355261&view=rev
Log:
CAMEL-5405: Ensure mina producer always disconnects if configured to do so, even for timeouts
when doing request/reply.

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

Modified: camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java?rev=1355261&r1=1355260&r2=1355261&view=diff
==============================================================================
--- camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
(original)
+++ camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
Fri Jun 29 08:18:45 2012
@@ -73,6 +73,15 @@ public class MinaProducer extends Defaul
     }
 
     public void process(Exchange exchange) throws Exception {
+        try {
+            doProcess(exchange);
+        } finally {
+            // ensure we always disconnect if configured
+            maybeDisconnectOnDone(exchange);
+        }
+    }
+
+    protected void doProcess(Exchange exchange) throws Exception {
         if (session == null && !lazySessionCreation) {
             throw new IllegalStateException("Not started yet!");
         }
@@ -141,6 +150,12 @@ public class MinaProducer extends Defaul
                 }
             }
         }
+    }
+
+    protected void maybeDisconnectOnDone(Exchange exchange) {
+        if (session == null) {
+            return;
+        }
 
         // should session be closed after complete?
         Boolean close;



Mime
View raw message