[jboss-cvs] JBoss Messaging SVN: r8507 - in branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client: remoting and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 29 10:37:35 EST 2012


Author: raggz
Date: 2012-02-29 10:37:34 -0500 (Wed, 29 Feb 2012)
New Revision: 8507

Modified:
   branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/container/ConnectionAspect.java
   branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
Log:
JBPAPP-8291.


Modified: branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/container/ConnectionAspect.java
===================================================================
--- branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/container/ConnectionAspect.java	2012-02-29 14:45:58 UTC (rev 8506)
+++ branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/container/ConnectionAspect.java	2012-02-29 15:37:34 UTC (rev 8507)
@@ -178,15 +178,18 @@
 	
 	      JMSRemotingConnection remotingConnection = state.getRemotingConnection();
 	
-	      // remove the consolidated remoting connection listener
-	
-	      ConsolidatedRemotingConnectionListener l = remotingConnection.removeConnectionListener();
-	      if (l != null)
-	      {
-	         l.clear();
-	      }
-	
-	      // Finished with the connection - we need to shutdown callback server
+         // remove the consolidated remoting connection listener
+         ConsolidatedRemotingConnectionListener l = remotingConnection.removeConnectionListener();
+	      
+         if (l != null)
+         {
+            if (l.setBeingHandled())
+            {
+               l.clear();
+            }
+         }
+
+         // Finished with the connection - we need to shutdown callback server
 	      remotingConnection.stop();
 	       
 	      // And to resource manager

Modified: branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
===================================================================
--- branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java	2012-02-29 14:45:58 UTC (rev 8506)
+++ branches/JBossMessaging_1_4_8_SP1_JBMessaging-1912/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java	2012-02-29 15:37:34 UTC (rev 8507)
@@ -49,6 +49,10 @@
 
    private Object jmsExceptionLock = new Object();
 
+   private Object exceptionLock = new Object();
+   
+   private boolean beingHandled = false;
+
    // Constructors ---------------------------------------------------------------------------------
 
    public ConsolidatedRemotingConnectionListener()
@@ -65,6 +69,12 @@
       {
          return;
       }
+      
+      //if the connection is already closed then there is no point handling it again.
+      if (!setBeingHandled())
+      {
+         return;
+      }
             
       // forward the exception to delegate listener and JMS ExceptionListeners;
       boolean forwardToJMSListener = true;
@@ -186,6 +196,20 @@
       remotingListener = null;
       log.trace(this + " cleared");
    }
+   
+   //https://issues.jboss.org/browse/JBMESSAGING-1912
+   public boolean setBeingHandled()
+   {
+      synchronized (exceptionLock)
+      {
+         if (beingHandled)
+         {
+            return false;
+         }
+         beingHandled = true;
+         return true;
+      }
+   }
 
    private void clearJmsExceptionListener()
    {



More information about the jboss-cvs-commits mailing list