[jboss-cvs] JBoss Messaging SVN: r8180 - branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 21 05:04:31 EST 2011
Author: gaohoward
Date: 2011-01-21 05:04:31 -0500 (Fri, 21 Jan 2011)
New Revision: 8180
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-20 13:59:30 UTC (rev 8179)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-01-21 10:04:31 UTC (rev 8180)
@@ -260,7 +260,7 @@
private StateMonitor stateMonitor = null;
- private Map<Integer, QuarantinedNode> quarantinedNodes = new java.util.concurrent.ConcurrentHashMap<Integer, QuarantinedNode>();
+ private Map<Integer, QuarantinedNode> suspectedNodes = new java.util.concurrent.ConcurrentHashMap<Integer, QuarantinedNode>();
private ClusterState clusterState = new ClusterState();
@@ -517,12 +517,12 @@
new UpdateState().executeWithRetry();
}
- private void cleanUpQuarantinedNode(final Integer qNode) throws Exception
+ private void cleanUpSuspectedNode(final Integer qNode) throws Exception
{
- QuarantinedNode node = quarantinedNodes.remove(qNode);
+ QuarantinedNode node = suspectedNodes.remove(qNode);
if (node == null)
{
- log.warn("Cannot find the quarantined node.");
+ log.warn("Cannot find the suspected node.");
}
//clean from DB
@@ -559,7 +559,7 @@
*/
private void processClusterState() throws Exception
{
- Iterator<Integer> iter = quarantinedNodes.keySet().iterator();
+ Iterator<Integer> iter = suspectedNodes.keySet().iterator();
ClusterState clusterStateCopy = clusterState.copy();
@@ -571,7 +571,7 @@
//update node status. this definitely not me!
this.updateStateInStorage(qNodeID, STATE_DEAD);
- QuarantinedNode qNode = quarantinedNodes.get(qNodeID);
+ QuarantinedNode qNode = suspectedNodes.get(qNodeID);
Integer fNodeID = qNode.getFailover();
Integer foNodeID = (Integer)failoverMap.get(fNodeID);
@@ -580,37 +580,24 @@
throw new IllegalStateException("Failover node " + fNodeID + " for node " + qNode + " is not alive!");
}
- boolean failoverDone = false;
-
if (fNodeID.intValue() == thisNodeID)
{
//I am the failover node for the dead, perform failover now
- if (quarantinedNodes.get(qNodeID).shouldFailover() && isSupportsFailover())
+ if (suspectedNodes.get(qNodeID).shouldFailover() && isSupportsFailover())
{
log.debug(this + ": I am the failover node for node " + qNodeID + " that crashed");
performFailover(qNodeID);
//now clean up the quarantined set
- cleanUpQuarantinedNode(qNodeID);
+ cleanUpSuspectedNode(qNodeID);
//broadcast
NodeDeadRequest request = new NodeDeadRequest(qNodeID);
groupMember.multicastControl(request, true);
-
- failoverDone = true;
}
}
-
- if ((!failoverDone) && (!clusterStateCopy.isQuarantined(qNodeID)))
- {
- //I am not the failover node for the dead, clean up now. But don't delete it from quarantined map
- //nor from the DB. we wait for it to be failed over. Two possible cases:
- //1 this node later becomes the failover for the dead node, so this node cleans up it.
- //2 other node failed over the dead node, this node get notified and clean up it.
- cleanDataForNode(qNodeID);
- }
}
}
}
@@ -1379,7 +1366,7 @@
return;
}
- QuarantinedNode qNode = quarantinedNodes.remove(newNode);
+ QuarantinedNode qNode = suspectedNodes.remove(newNode);
if (qNode == null) return;
@@ -1557,10 +1544,10 @@
QuarantinedNode qNode = new QuarantinedNode(leftNodeID, fnodeID, crashed);
//now we need take care of those already quarantined nodes
- Iterator<Integer> iterQ = quarantinedNodes.keySet().iterator();
+ Iterator<Integer> iterQ = suspectedNodes.keySet().iterator();
while (iterQ.hasNext())
{
- QuarantinedNode aNode = quarantinedNodes.get(iterQ.next());
+ QuarantinedNode aNode = suspectedNodes.get(iterQ.next());
if (aNode.getFailover().equals(leftNodeID))
{
//We need to transfer the failover responsibility to the new active one
@@ -1568,11 +1555,15 @@
}
}
- quarantinedNodes.put(leftNodeID, qNode);
-
- if (fnodeID == thisNodeID)
+ 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)
{
- this.updateStateInStorage(leftNodeID, STATE_QUARANTINED);
+ this.updateStateInStorage(thisNodeID, STATE_QUARANTINED);
}
if (trace) { log.trace("Quarantined node: " + qNode); }
@@ -1760,7 +1751,7 @@
//so it's safe to remove it now.
public void handleNodeDead(int nodeId)
{
- QuarantinedNode node = quarantinedNodes.remove(nodeId);
+ QuarantinedNode node = suspectedNodes.remove(nodeId);
log.info("Quarantined node " + node + " is finally dead.");
}
@@ -3806,8 +3797,11 @@
//Now clean the data for the failed node
//TODO - does this need to be inside the lock above?
- cleanDataForNode(failedNodeID);
-
+ if (keepOldFailoverModel)
+ {
+ cleanDataForNode(failedNodeID);
+ }
+
log.debug(this + " announcing that failover procedure is complete");
notification = new ClusterNotification(ClusterNotification.TYPE_FAILOVER_END, failedNodeID.intValue(), null);
More information about the jboss-cvs-commits
mailing list