[jboss-cvs] JBoss Messaging SVN: r8191 - branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 24 10:14:34 EST 2011


Author: gaohoward
Date: 2011-01-24 10:14:34 -0500 (Mon, 24 Jan 2011)
New Revision: 8191

Modified:
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/ClusterRequest.java
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
save


Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/ClusterRequest.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/ClusterRequest.java	2011-01-23 02:57:20 UTC (rev 8190)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/ClusterRequest.java	2011-01-24 15:14:34 UTC (rev 8191)
@@ -150,11 +150,6 @@
          	request = new GetReplicatedDeliveriesRequest();
          	break;
          }
-         case NODE_DEAD_REQUEST:
-         {
-            request = new NodeDeadRequest();
-            break;
-         }
          default:
          {
             throw new IllegalArgumentException("Invalid type: " + type);

Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-01-23 02:57:20 UTC (rev 8190)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-01-24 15:14:34 UTC (rev 8191)
@@ -616,6 +616,10 @@
             //node all have chance to do the failover. We need to make sure this only happen once.
             if (fNodeID.intValue() == thisNodeID)
             {
+               ClusterNotification notification = new ClusterNotification(ClusterNotification.TYPE_NODE_LEAVE, qNodeID.intValue(), null);
+
+               clusterNotifier.sendNotification(notification);
+
                // I am the failover node for the dead, perform failover now
                if (suspectedNodes.get(qNodeID).shouldFailover() && isSupportsFailover())
                {
@@ -1400,7 +1404,7 @@
       
       if (newNode == null)
       {
-         //myself
+         //newly Joined node not added yet.
          return;
       }
       
@@ -1414,8 +1418,20 @@
       if (clusterState.isQuarantined(thisNodeID))
       {
          updateStateInStorage(thisNodeID, STATE_CLUSTERED);
-         PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(), groupMember.getDataChannelAddress());
-         groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
+         new Thread() {
+            public void run()
+            {
+               PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(), groupMember.getDataChannelAddress());
+               try
+               {
+                  groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
+               }
+               catch (Exception e)
+               {
+                  log.error("error sending node join request!", e);
+               }
+            }
+         }.start();
       }
    }
    
@@ -1471,10 +1487,6 @@
             log.debug(this + " the failover node for the crashed node is " + fnodeID);
                
             boolean doneFailover = false;
-            
-            ClusterNotification notification = new ClusterNotification(ClusterNotification.TYPE_NODE_LEAVE, leftNodeID.intValue(), null);
-            
-            clusterNotifier.sendNotification(notification);
          
             if (crashed && isSupportsFailover())
             {        
@@ -1597,7 +1609,7 @@
 
          if (isFirstNode())
          {
-            this.updateStateInStorage(thisNodeID, STATE_QUARANTINED);
+            clusterState.updateNodeState(thisNodeID, STATE_QUARANTINED);
          }
          
          if (trace) { log.trace("Quarantined node: " + qNode); }
@@ -4030,6 +4042,13 @@
       {
          states = new HashMap<Integer, NodeState>(copy);
       }
+      
+      public void updateNodeState(int nodeID, int newState) throws Exception
+      {
+         NodeState node = states.get(nodeID);
+         node.setState(newState);
+         updateStateInStorage(nodeID, newState);
+      }
 
       public boolean allDeadButMe(int nodeID)
       {
@@ -4095,6 +4114,11 @@
          this.state = state;
       }
 
+      public void setState(int newState)
+      {
+         state = newState;
+      }
+
       public int getID()
       {
          return nodeID;
@@ -4120,7 +4144,7 @@
 
    public boolean isAvailable()
    {
-      return clusterState.isQuarantined(thisNodeID);
+      return !clusterState.isQuarantined(thisNodeID);
    }
 
    public boolean isKeepOldFailoverModel()



More information about the jboss-cvs-commits mailing list