[jboss-cvs] JBoss Messaging SVN: r8559 - branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 20 10:24:49 EDT 2012
Author: gaohoward
Date: 2012-08-20 10:24:49 -0400 (Mon, 20 Aug 2012)
New Revision: 8559
Modified:
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
JBMESSAGING-1931
fix issue when jgroups and DB failure at the same time;
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2012-08-16 04:30:32 UTC (rev 8558)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2012-08-20 14:24:49 UTC (rev 8559)
@@ -279,6 +279,8 @@
private Set<Condition> inactiveConditions = new ConcurrentHashSet<Condition>();
+ private int initMembers;
+
// Constructors ---------------------------------------------------------------------------------
public boolean isFailoverOnNodeLeave()
@@ -455,14 +457,14 @@
}
//Now load the bindings for this node
-
- loadBindings();
-
+
+ loadBindings();
+
started = true;
- log.debug(this + " started");
+ log.debug(this + " started with initMember " + initMembers);
}
-
+
//this method will trigger a dedicated thread to write time stamp
private synchronized void initClusterState() throws Exception
{
@@ -499,6 +501,7 @@
if (row == 0)
{
+ log.trace("inserting this node " + thisNodeID + " to the DB table");
ps1 = conn.prepareStatement(getSQLStatement("INSERT_NODE_STATE"));
ps1.setInt(1, thisNodeID);
ps1.setInt(2, STATE_CLUSTERED);
@@ -738,14 +741,13 @@
if (result > 0)
{
log.debug("Successfully updated cluster health timestamp for node " + thisNodeID);
+ timestampDone = true;
}
else if (result == 0)
{
log.debug("Cluster health timestamp update for node " + thisNodeID + " failed!");
}
- timestampDone = true;
-
synchronized (clusterState)
{
clusterState.clear();
@@ -2929,9 +2931,18 @@
//This is ok - it wil be shortly followed by another calculation of the map
}
+ initMembers = initMembers < failoverMap.size() ? failoverMap.size() : initMembers;
+
+ log.trace("initMembers updated to: " + initMembers);
log.debug("Updated failover map:\n" + dumpFailoverMap(failoverMap));
}
+ private boolean iAmAlone()
+ {
+ if (trace) { log.trace("If I am alone in failover Map: " + failoverMap.size() + " initMembers: " + initMembers); }
+ return (failoverMap.size() == 1) && (initMembers > 1);
+ }
+
private Integer findNodeIDForAddress(Address address)
{
Integer theNodeID = null;
@@ -4265,7 +4276,6 @@
{
do
{
- ClusterState newState;
boolean timeStampDone = false;
try
{
@@ -4275,7 +4285,7 @@
{
processClusterState();
}
- else if (clusterState.isQuarantined(thisNodeID))
+ else if (clusterState.isQuarantined(thisNodeID) || iAmAlone())
{
log.error("I'm orphaned and now I can't tell others that I'm alive. Shutdown node: " + thisNodeID);
stopJBMNodeForRecovery();
More information about the jboss-cvs-commits
mailing list