[jboss-cvs] JBoss Messaging SVN: r1706 - branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 5 10:25:55 EST 2006


Author: timfox
Date: 2006-12-05 10:25:53 -0500 (Tue, 05 Dec 2006)
New Revision: 1706

Modified:
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
Log:
a few more bits and pieces



Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-05 14:06:32 UTC (rev 1705)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-05 15:25:53 UTC (rev 1706)
@@ -331,8 +331,6 @@
       
       put(ADDRESS_INFO_KEY, info);
 
-      //verifyMembership(null, this.currentView);
-
       statsSender.start();
       
       started = true;
@@ -346,22 +344,24 @@
       {
          log.warn("Attempt to stop() but " + this + " is not started");
       }
-
-      syncSendRequest(new LeaveClusterRequest(this.getNodeId()));
-      
-      super.stop(sendNotification);
-      
-      unregisterListener(nodeAddressMapListener);
-      
-      statsSender.stop();
+      else
+      {   
+         syncSendRequest(new LeaveClusterRequest(this.getNodeId()));
          
-      syncChannel.close();
-      
-      asyncChannel.close();
-      
-      started = false;
-      
-      if (trace) { log.trace("Stopped " + this); }
+         super.stop(sendNotification);
+         
+         unregisterListener(nodeAddressMapListener);
+         
+         statsSender.stop();
+            
+         syncChannel.close();
+         
+         asyncChannel.close();
+         
+         started = false;
+         
+         if (trace) { log.trace("Stopped " + this); }
+      }
    }  
    
    // PostOffice implementation ---------------------------------------        
@@ -1309,38 +1309,28 @@
     *  Verifies changes on the View deciding if a node joined or lefted the cluster
     *
     * */
-   private void verifyMembership(View oldView, View newView)
+   private void verifyMembership(View oldView, View newView) throws Throwable
    {
-      try
+      if (oldView != null)
       {
-         if (oldView != null)
+         for (Iterator i = oldView.getMembers().iterator(); i.hasNext(); )
          {
-            for (Iterator i = oldView.getMembers().iterator(); i.hasNext(); )
+            Address address = (Address)i.next();
+            if (!newView.containsMember(address))
             {
-               Address address = (Address)i.next();
-               if (!newView.containsMember(address))
-               {
-                  nodeLeft(address);
-               }
+               nodeLeft(address);
             }
          }
+      }
 
-         for (Iterator i = newView.getMembers().iterator(); i.hasNext(); )
+      for (Iterator i = newView.getMembers().iterator(); i.hasNext(); )
+      {
+         Address address = (Address)i.next();
+         if (oldView == null || !oldView.containsMember(address))
          {
-            Address address = (Address)i.next();
-            if (oldView == null || !oldView.containsMember(address))
-            {
-               nodeJoined(address);
-            }
+            nodeJoined(address);
          }
       }
-      catch (Throwable e)
-      {
-         log.error("Caught Exception in MembershipListener", e);
-         IllegalStateException e2 = new IllegalStateException(e.getMessage());
-         e2.setStackTrace(e.getStackTrace());
-         throw e2;
-      }
    }
 
 
@@ -2337,18 +2327,17 @@
          View oldView = currentView;
          currentView = newView;
 
-         // Since now membership is sent over state transfer, we have to wait stateSet to be set.
-         // If this logic is not good enough, we will have to place Address in a separate data structure
-         // as it used to be (NodeInfos) - Clebert
-         
-         
-         // FIXME - I don't understand why this check with flag (stateSet)is necessary
-         //The state will always be set before any view changes occur - JGroups guarantees this -
-         //Maybe I am wrong - Tim
-//         if (stateSet)
-//         {
+         try
+         {
             verifyMembership(oldView, newView);
-        // }
+         }
+         catch (Throwable e)
+         {
+            log.error("Caught Exception in MembershipListener", e);
+            IllegalStateException e2 = new IllegalStateException(e.getMessage());
+            e2.setStackTrace(e.getStackTrace());
+            throw e2;
+         }
       }
 
       public byte[] getState()




More information about the jboss-cvs-commits mailing list