[jboss-cvs] JBoss Messaging SVN: r8183 - 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 06:12:36 EST 2011
Author: gaohoward
Date: 2011-01-21 06:12:34 -0500 (Fri, 21 Jan 2011)
New Revision: 8183
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 10:38:27 UTC (rev 8182)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-01-21 11:12:34 UTC (rev 8183)
@@ -603,6 +603,19 @@
groupMember.multicastControl(request, true);
}
}
+ else
+ {
+ //if all nodes becomes quarantined, including myself, I have to try claim the dead also
+ if (clusterState.allDeadButMe(thisNodeID))
+ {
+ log.info(this + ": I am the only one alive, so pick up the dead ones");
+ performFailover(qNodeID);
+
+ cleanUpSuspectedNode(qNodeID);
+
+ //no need to broadcast as no one is listening.
+ }
+ }
}
}
}
@@ -3992,6 +4005,7 @@
}
}
+ //not for concurrent use!
private class ClusterState
{
Map<Integer, NodeState> states = new HashMap<Integer, NodeState>();
@@ -4001,6 +4015,20 @@
states = new HashMap<Integer, NodeState>(copy);
}
+ public boolean allDeadButMe(int nodeID)
+ {
+ Iterator<NodeState> iter = states.values().iterator();
+ while (iter.hasNext())
+ {
+ NodeState node = iter.next();
+ if (!node.isDead() && (node.getID() != nodeID))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
public void clear()
{
states.clear();
@@ -4015,7 +4043,7 @@
states.put(nodeID, new NodeState(nodeID, timestamp, nodeState));
}
- public synchronized ClusterState copy()
+ public ClusterState copy()
{
return new ClusterState(states);
}
@@ -4051,6 +4079,11 @@
this.state = state;
}
+ public int getID()
+ {
+ return nodeID;
+ }
+
public boolean isQurarntined()
{
return state == STATE_QUARANTINED;
More information about the jboss-cvs-commits
mailing list