ALF-10934: Prevent potential start/stop ping-pong of subsystems across a cluster

- When a cluster boots up or receives a reinit message it shouldn't be sending out any start messages

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31732 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-11-04 12:30:53 +00:00
parent a400747605
commit 0772435bda

View File

@@ -231,7 +231,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
{
if (start)
{
start(true);
start(true, false);
}
return this.state;
}
@@ -470,7 +470,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
this.lock.writeLock().lock();
try
{
start(false);
start(false, false);
}
catch (Exception e)
{
@@ -496,7 +496,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
destroy(false);
// fall through
case UNINITIALIZED:
start(false);
start(false, false);
}
}
finally
@@ -595,7 +595,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
}
// Attempt to start locally
start(false);
start(false, true);
// We still haven't broadcast the start - a persist is required first so this will be done by the caller
}
@@ -608,7 +608,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
}
// Bring the bean back up across the cluster
start(true);
start(true, false);
if (e instanceof RuntimeException)
{
throw (RuntimeException) e;
@@ -630,7 +630,7 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
this.lock.writeLock().lock();
try
{
start(true);
start(true, false);
}
finally
{
@@ -641,10 +641,12 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
/**
* Starts the bean, optionally broadcasting the event to remote nodes.
*
* @param broadcast
* Should the event be broadcast?
* @param broadcastNow
* Should the event be broadcast immediately?
* @param broadcastLater
* Should the event be broadcast ever?
*/
protected void start(boolean broadcast)
protected void start(boolean broadcastNow, boolean broadcastLater)
{
boolean hadWriteLock = this.lock.isWriteLockedByCurrentThread();
if (this.runtimeState != RuntimeState.STARTED)
@@ -663,10 +665,10 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
// fall through
case STOPPED:
this.state.start();
this.runtimeState = RuntimeState.PENDING_BROADCAST_START;
this.runtimeState = broadcastLater ? RuntimeState.PENDING_BROADCAST_START : RuntimeState.STARTED;
// fall through
case PENDING_BROADCAST_START:
if (broadcast)
if (broadcastNow)
{
this.registry.broadcastStart(this);
this.runtimeState = RuntimeState.STARTED;