You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2010/06/10 15:21:53 UTC

svn commit: r953318 - /servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java

Author: gertv
Date: Thu Jun 10 13:21:52 2010
New Revision: 953318

URL: http://svn.apache.org/viewvc?rev=953318&view=rev
Log:
SMX4NMR-194: JBI Cluster engine exception at shutdown

Modified:
    servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java

Modified: servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java?rev=953318&r1=953317&r2=953318&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java Thu Jun 10 13:21:52 2010
@@ -71,18 +71,36 @@ public class ActiveMQJmsRequestorPool ex
         return true;
     }
 
+    public void destroy() {
+        if (sharedConnectionEnabled()) {
+            removeExceptionListener();
+        }
+        super.destroy();
+    }
+
     public void onException(JMSException exception) {
         handleListenerException(exception);
         if (sharedConnectionEnabled()) {
             try {
+                removeExceptionListener();
                 refreshSharedConnection();
-            } catch (JMSException e) {
+            } catch (Exception e) {
                 logger.debug("Error while refreshing shared connection", e);
             }
         }
         recreateConsumers(true);
     }
 
+    private void removeExceptionListener() {
+        try {
+            getSharedConnection().setExceptionListener(null);
+        } catch (JMSException e) {
+            logger.debug("Unable to remove exception listener", e);
+        } catch (SharedConnectionNotInitializedException e) {
+            // ignore this -- there was no need to unset the exception listener in the first place
+        }
+    }    
+
     protected Connection createConnection() throws JMSException {
         Connection con =  getConnectionFactory().createConnection();
         con.setExceptionListener(this);