[jboss-cvs] JBoss Messaging SVN: r8617 - branches/Branch_JBossMessaging_1_4_0_SP3_CP14_JBMESSAGING-1896_JBMESSAGING-1901_JBMESSAGING-1931/src/main/org/jboss/messaging/core/impl/postoffice.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 23 06:28:20 EDT 2013
Author: raggz
Date: 2013-09-23 06:28:19 -0400 (Mon, 23 Sep 2013)
New Revision: 8617
Modified:
branches/Branch_JBossMessaging_1_4_0_SP3_CP14_JBMESSAGING-1896_JBMESSAGING-1901_JBMESSAGING-1931/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
Backport of JBMessaging-1947.
Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP14_JBMESSAGING-1896_JBMESSAGING-1901_JBMESSAGING-1931/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP14_JBMESSAGING-1896_JBMESSAGING-1901_JBMESSAGING-1931/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2013-09-20 06:22:02 UTC (rev 8616)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP14_JBMESSAGING-1896_JBMESSAGING-1901_JBMESSAGING-1931/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2013-09-23 10:28:19 UTC (rev 8617)
@@ -4245,6 +4245,7 @@
private class StateMonitor extends Thread
{
private boolean working = true;
+ private boolean stoppingNode = false;
public StateMonitor()
{
@@ -4259,50 +4260,73 @@
}
}
- public synchronized void stopJBMNodeForRecovery()
+ public void stopJBMNodeForRecovery()
{
- disableViewUpdate();
- serverPeer.stopJBMNodeForRecovery();
+ synchronized(this)
+ {
+ if (stoppingNode) return;
+ stoppingNode = true;
+ }
+
+ //using a new thread.
+ new Thread(new Runnable() {
+
+ public void run()
+ {
+ disableViewUpdate();
+ serverPeer.stopJBMNodeForRecovery();
+ }
+
+ }).start();
}
public synchronized void run()
{
- do
+ boolean shutdownNode = false;
+ synchronized(this)
{
- boolean timeStampDone = false;
- try
+ do
{
- timeStampDone = refreshNodeState();
-
- if (timeStampDone)
+ boolean timeStampDone = false;
+ try
{
- processClusterState();
- }
- 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();
- working = false;
- nodeStateRefreshInterval = 1; //let the thread quite quickly.
- }
+ timeStampDone = refreshNodeState();
- try
- {
- wait(nodeStateRefreshInterval);
+ if (timeStampDone)
+ {
+ processClusterState();
+ }
+ 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);
+ shutdownNode = true;
+ working = false;
+ break;
+ }
+
+ try
+ {
+ wait(nodeStateRefreshInterval);
+ }
+ catch (InterruptedException e)
+ {
+ }
}
- catch (InterruptedException e)
+ catch (Exception e)
{
+ log.error("Error refreshing state of node: " + thisNodeID, e);
}
- }
- catch (Exception e)
- {
- log.error("Error refreshing state of node: " + thisNodeID, e);
- }
- } while (working);
- log.debug("Stop monitoring the stats at node " + thisNodeID);
- }
+ } while (working);
+ log.debug("Stop monitoring the stats at node " + thisNodeID);
+ }
+ if (shutdownNode)
+ {
+ stopJBMNodeForRecovery();
+ }
+ }
+
public synchronized void shutdown()
{
working = false;
More information about the jboss-cvs-commits
mailing list