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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 22 02:50:54 EST 2011


Author: gaohoward
Date: 2011-01-22 02:50:52 -0500 (Sat, 22 Jan 2011)
New Revision: 8186

Removed:
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/NodeDeadRequest.java
Modified:
   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/MessagingPostOffice.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-01-21 13:07:12 UTC (rev 8185)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-01-22 07:50:52 UTC (rev 8186)
@@ -590,10 +590,14 @@
          
          Boolean isDead = clusterStateCopy.isNodeDead(qNodeID);
          
-         if (isDead == null) continue;
-         
-         if (isDead)
+         if (isDead == null)
          {
+            //someone else done the job.
+            cleanDataForNode(qNodeID);
+            suspectedNodes.remove(qNodeID);
+         }
+         else if (isDead)
+         {
 
             QuarantinedNode qNode = suspectedNodes.get(qNodeID);
             Integer fNodeID = qNode.getFailover();
@@ -605,6 +609,11 @@
             }
 
             //every suspected node must have a one and only failover node.
+            //however, each dead node may have multiple failover nodes that are not in one 'brain'
+            //if a node is quarantined, it suspects all other nodes which could be still in the cluster.
+            //so this left node will be failover node for all of them, at the same time cluster nodes
+            //have a strict failover map. If a node in cluster dies, this left node and it's 'legitimate' failover
+            //node all have chance to do the failover. We need to make sure this only happen once.
             if (fNodeID.intValue() == thisNodeID)
             {
                // I am the failover node for the dead, perform failover now
@@ -619,13 +628,14 @@
 
                   // now clean up the quarantined set
                   cleanUpSuspectedNode(qNodeID);
-
-                  // broadcast
-                  NodeDeadRequest request = new NodeDeadRequest(qNodeID);
-
-                  groupMember.multicastControl(request, true);
                }
             }
+            else
+            {
+               //now clean up the node from this node.
+               cleanDataForNode(qNodeID);
+               suspectedNodes.remove(qNodeID);
+            }
          }
       }
    }
@@ -1585,9 +1595,6 @@
          
          suspectedNodes.put(leftNodeID, qNode);
 
-         //now clean up the node from this node.
-         cleanDataForNode(leftNodeID);
-
          //only update itself -- when the new failoverMap has only one node (must be me)
          if (failoverMap.size() == 1)
          {

Deleted: branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/NodeDeadRequest.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/NodeDeadRequest.java	2011-01-21 13:07:12 UTC (rev 8185)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/NodeDeadRequest.java	2011-01-22 07:50:52 UTC (rev 8186)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2011, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.jboss.messaging.core.impl.postoffice;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-/**
- * A NodeDeadRequest
- *
- * @author howard
- * 
- * Created Jan 19, 2011 1:17:36 AM
- *
- *
- */
-public class NodeDeadRequest extends ClusterRequest
-{
-   private int leftNode;
-
-   public NodeDeadRequest(Integer qNode)
-   {
-      leftNode = qNode.intValue();
-   }
-   
-   public NodeDeadRequest()
-   {
-   }
-
-   public void write(DataOutputStream out) throws Exception
-   {
-      out.writeInt(leftNode);
-   }
-
-   public void read(DataInputStream in) throws Exception
-   {
-      leftNode = in.readInt();
-   }
-
-   Object execute(RequestTarget office) throws Throwable
-   {
-      office.handleNodeDead(leftNode);
-      return null;
-   }
-
-   byte getType()
-   {
-      return ClusterRequest.NODE_DEAD_REQUEST;
-   }
-}



More information about the jboss-cvs-commits mailing list