[jboss-cvs] JBoss Messaging SVN: r8420 - branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 16 03:00:12 EDT 2011


Author: gaohoward
Date: 2011-08-16 03:00:12 -0400 (Tue, 16 Aug 2011)
New Revision: 8420

Modified:
   branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/ClusteredMessagingXAResourceRecovery.java
   branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper2.java
Log:
fix 2


Modified: branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/ClusteredMessagingXAResourceRecovery.java
===================================================================
--- branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/ClusteredMessagingXAResourceRecovery.java	2011-08-15 14:25:11 UTC (rev 8419)
+++ branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/ClusteredMessagingXAResourceRecovery.java	2011-08-16 07:00:12 UTC (rev 8420)
@@ -119,8 +119,9 @@
    }
 
    /*
-    * Iterates the resources. If no more, clean up the resources
-    * and update again.
+    * Iterates the resources. Note we can't clean up the resources right after 
+    * we find no more resources because the recovery manager will still use it.
+    * It is safe to do clean up of resources at next scan
     */
    public boolean hasMoreResources()
    {
@@ -128,8 +129,9 @@
       
       log.error(this + " xxxxxxx hasMore res " + resources);
       
-      if (resources == null)
+      if (iterator == null)
       {
+         shutdownResources();
          updateResources();
       }
       
@@ -139,10 +141,10 @@
          return true;
       }
       
-      this.shutdownResources();
-      
       log.error(this + " xxxxxxx no we dont");
       
+      iterator = null;
+      
       return false;
    }
 

Modified: branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper2.java
===================================================================
--- branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper2.java	2011-08-15 14:25:11 UTC (rev 8419)
+++ branches/JBMESSAGING_1890/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper2.java	2011-08-16 07:00:12 UTC (rev 8420)
@@ -51,9 +51,6 @@
 {
    /** The log */
    private static final Logger log = Logger.getLogger(MessagingXAResourceWrapper2.class);
-
-   /** The state lock */
-   private static final Object lock = new Object();
    
    /** The connection */
    private ClientConnectionDelegate connection;
@@ -218,25 +215,23 @@
     */
    public void close()
    {
+      log.error(this + " xxxxxxxxXXXXXXXxxxxxxxx cleaning up myself 9....");
       try
       {
-         ClientConnectionDelegate oldConnection = null;
-         synchronized (lock)
+         if (connection != null)
          {
-            oldConnection = connection;
-            connection = null;
-            delegate = null;
+            connection.closing(-1);
+            connection.close();
          }
-         if (oldConnection != null)
-         {
-            oldConnection.closing(-1);
-            oldConnection.close();
-         }
       }
       catch (Exception ignored)
       {
          log.trace("Ignored error during close", ignored);
       }
+      finally
+      {
+         connection = null;
+      }
    }
 
    /**



More information about the jboss-cvs-commits mailing list