camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [1/2] camel git commit: CAMEL-9739 Mina2Consumer exception handler do close session also for IOException. Thanks to Thomas Papke for the patch.
Date Tue, 22 Mar 2016 12:39:04 GMT
Repository: camel
Updated Branches:
  refs/heads/master 52e980041 -> fa49a16b5


CAMEL-9739 Mina2Consumer exception handler do close session also for IOException. Thanks to
Thomas Papke for the patch.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b87b7745
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b87b7745
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b87b7745

Branch: refs/heads/master
Commit: b87b7745f11d4bab039d501bf6e614809d96e607
Parents: 52e9800
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Tue Mar 22 13:30:18 2016 +0100
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Tue Mar 22 13:36:40 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/component/mina2/Mina2Consumer.java    | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b87b7745/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
index 9e58365..6fd5a8b 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.mina2;
 
+import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.charset.Charset;
@@ -58,7 +59,7 @@ import org.slf4j.LoggerFactory;
 /**
  * A {@link org.apache.camel.Consumer Consumer} implementation for Apache MINA.
  *
- * @version 
+ * @version
  */
 public class Mina2Consumer extends DefaultConsumer {
 
@@ -67,14 +68,14 @@ public class Mina2Consumer extends DefaultConsumer {
     private IoConnector connector;
     private SocketAddress address;
     private IoAcceptor acceptor;
-    private Mina2Configuration configuration;
+    private final Mina2Configuration configuration;
     private ExecutorService workerPool;
 
     public Mina2Consumer(final Mina2Endpoint endpoint, Processor processor) throws Exception
{
         super(endpoint, processor);
         this.configuration = endpoint.getConfiguration();
         //
-        // All mina2 endpoints are InOut. The endpoints are asynchronous. 
+        // All mina2 endpoints are InOut. The endpoints are asynchronous.
         // Endpoints can send "n" messages and receive "m" messages.
         //
         this.getEndpoint().setExchangePattern(ExchangePattern.InOut);
@@ -127,7 +128,7 @@ public class Mina2Consumer extends DefaultConsumer {
                     acceptor.unbind(acceptor.getLocalAddresses());
                 } else {
                     acceptor.unbind(address);
-                }   
+                }
             } else {
                 acceptor.unbind(address);
             }
@@ -374,6 +375,10 @@ public class Mina2Consumer extends DefaultConsumer {
 
         @Override
         public void exceptionCaught(IoSession session, Throwable cause) throws Exception
{
+            if (cause instanceof IOException){
+                LOG.debug("IOExceptions are automatically handled by MINA");
+                return;
+            }
             // close invalid session
             if (session != null) {
                 LOG.warn("Closing session as an exception was thrown from MINA");


Mime
View raw message