ARTEMIS-1842 make sure quorum vote loops exits

This commit is contained in:
andytaylor 2018-05-02 11:39:13 +01:00 committed by Clebert Suconic
parent e8a1e43ea2
commit 2de1e49e5f
1 changed files with 4 additions and 1 deletions

View File

@ -64,6 +64,8 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
private final NetworkHealthCheck networkHealthCheck; private final NetworkHealthCheck networkHealthCheck;
private boolean stopped = false;
/** /**
* This is a safety net in case the live sends the first {@link ReplicationLiveIsStoppingMessage} * This is a safety net in case the live sends the first {@link ReplicationLiveIsStoppingMessage}
* with code {@link org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage.LiveStopping#STOP_CALLED} and crashes before sending the second with * with code {@link org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage.LiveStopping#STOP_CALLED} and crashes before sending the second with
@ -266,6 +268,7 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
* @param explicitSignal the state we want to set the quorum manager to return * @param explicitSignal the state we want to set the quorum manager to return
*/ */
public synchronized void causeExit(BACKUP_ACTIVATION explicitSignal) { public synchronized void causeExit(BACKUP_ACTIVATION explicitSignal) {
stopped = true;
removeListener(); removeListener();
this.signal = explicitSignal; this.signal = explicitSignal;
latch.countDown(); latch.countDown();
@ -287,7 +290,7 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
int size = quorumSize == -1 ? quorumManager.getMaxClusterSize() : quorumSize; int size = quorumSize == -1 ? quorumManager.getMaxClusterSize() : quorumSize;
synchronized (voteGuard) { synchronized (voteGuard) {
while (!decision && voteAttempts++ < voteRetries) { while (!stopped && voteAttempts++ < voteRetries) {
//the live is dead so lets vote for quorum //the live is dead so lets vote for quorum
QuorumVoteServerConnect quorumVote = new QuorumVoteServerConnect(size, targetServerID); QuorumVoteServerConnect quorumVote = new QuorumVoteServerConnect(size, targetServerID);