[jboss-cvs] JBoss Messaging SVN: r8223 - in branches/port1842/src/main/org/jboss: messaging/core/impl/postoffice and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 15 09:49:20 EST 2011
Author: gaohoward
Date: 2011-02-15 09:49:20 -0500 (Tue, 15 Feb 2011)
New Revision: 8223
Modified:
branches/port1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
branches/port1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
fix failure in second restart issue, added retry when restart failed.
Modified: branches/port1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
===================================================================
--- branches/port1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java 2011-02-15 02:30:54 UTC (rev 8222)
+++ branches/port1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java 2011-02-15 14:49:20 UTC (rev 8223)
@@ -68,7 +68,6 @@
connectionFactories = new ArrayList<ObjectName>();
destinations = new ArrayList<ObjectName>();
- nodeRecovery = new NodeRecovery();
log.info(this + " started.");
}
@@ -80,8 +79,11 @@
connectionFactories.clear();
destinations.clear();
- nodeRecovery.abandon();
- nodeRecovery = null;
+ if (nodeRecovery != null)
+ {
+ nodeRecovery.abandon();
+ nodeRecovery = null;
+ }
log.info(this + " stopped.");
}
@@ -113,6 +115,8 @@
nodeStopped = true;
+ nodeRecovery = new NodeRecovery();
+
nodeRecovery.start();
log.info("JBM node is stopped.");
@@ -223,8 +227,15 @@
//wait for jgroups back
MessagingPostOffice pm = (MessagingPostOffice)JMXAccessor.getJMXAttributeOverSecurity(server, poName, "Instance");
- pm.waitForJGroups();
-
+ while (!pm.waitForJGroups())
+ {
+ log.info("Failed to start post office due to JGroups failure, retrying...");
+ this.stopService(poName);
+ makeSureDelay();
+ this.startService(poName);
+ pm = (MessagingPostOffice)JMXAccessor.getJMXAttributeOverSecurity(server, poName, "Instance");
+ }
+
List<ObjectName> copy = new ArrayList<ObjectName>(connectionFactories);
connectionFactories.clear();
//start cf
Modified: branches/port1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/port1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-02-15 02:30:54 UTC (rev 8222)
+++ branches/port1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2011-02-15 14:49:20 UTC (rev 8223)
@@ -4310,7 +4310,7 @@
groupMember.unregisterChannelInJmx(server, channelPartitionName);
}
- public void waitForJGroups()
+ public boolean waitForJGroups()
{
log.info("Waiting for JGroups...");
synchronized (jgroupsLock)
@@ -4352,20 +4352,29 @@
{
PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(),
groupMember.getDataChannelAddress());
+
+ boolean stateGot = groupMember.requestState();
// requestState
- if (!groupMember.requestState())
+ if (!stateGot)
{
log.info("couldn't get state, we are the first (coordinator).");
for (Address addr : newNodes)
{
if (!addr.equals(info.getControlChannelAddress()))
{
- groupMember.requestState(addr);
- break;
+ stateGot = groupMember.requestState(addr);
+ if (stateGot) break;
}
}
}
+
+ if (!stateGot)
+ {
+ log.info("We cannot get state from JGroups.");
+ return false;
+ }
+
nodeIDAddressMap.put(new Integer(thisNodeID), info);
// calculate failover map
@@ -4384,9 +4393,11 @@
catch (Exception e)
{
log.error("Error initializing state", e);
+ return false;
}
}
log.info("Now node is ready for work.");
+ return true;
}
}
More information about the jboss-cvs-commits
mailing list