Class SharedNothingBackupQuorum
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum
-
- All Implemented Interfaces:
SessionFailureListener,FailureListener,Quorum,LiveNodeLocator.BackupRegistrationListener
public class SharedNothingBackupQuorum extends Object implements Quorum, SessionFailureListener, LiveNodeLocator.BackupRegistrationListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSharedNothingBackupQuorum.BACKUP_ACTIVATION
-
Field Summary
Fields Modifier and Type Field Description static intWAIT_TIME_AFTER_FIRST_LIVE_STOPPING_MSGThis is a safety net in case the live sends the firstReplicationLiveIsStoppingMessagewith codeReplicationLiveIsStoppingMessage.LiveStopping.STOP_CALLEDand crashes before sending the second withReplicationLiveIsStoppingMessage.LiveStopping.FAIL_OVER.
-
Constructor Summary
Constructors Constructor Description SharedNothingBackupQuorum(NodeManager nodeManager, ScheduledExecutorService scheduledPool, NetworkHealthCheck networkHealthCheck, int quorumSize, int voteRetries, long voteRetryWait, int quorumVoteWait, boolean failback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeReconnect(ActiveMQException exception)voidcauseExit(SharedNothingBackupQuorum.BACKUP_ACTIVATION explicitSignal)Cause the Activation thread to exit and the server to be stopped.voidclose()called if the quorum manager is stopping so we can clean upvoidconnectionFailed(ActiveMQException exception, boolean failedOver)if the connection to our replicated live goes down then decide on an actionvoidconnectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID)voidfailOver(ReplicationLiveIsStoppingMessage.LiveStopping finalMessage)Releases the latch, causing the backup activation thread to fail-over.StringgetName()the name of the Quorum.voidliveIDSet(String liveID)voidnodeDown(Topology topology, long eventUID, String nodeID)if the node going down is the node we are replicating from then decide on an action.voidnodeUp(Topology topology)called by the quorum when a node in the quorum goes upvoidonBackupRegistrationFailed(boolean alreadyReplicating)voidreset()voidsetQuorumManager(QuorumManager quorumManager)called by the quorum manager when a quorum is registeredvoidsetSessionFactory(ClientSessionFactoryInternal sessionFactory)SharedNothingBackupQuorum.BACKUP_ACTIVATIONwaitForStatusChange()Called by the replicating backup (i.e.
-
-
-
Field Detail
-
WAIT_TIME_AFTER_FIRST_LIVE_STOPPING_MSG
public static final int WAIT_TIME_AFTER_FIRST_LIVE_STOPPING_MSG
This is a safety net in case the live sends the firstReplicationLiveIsStoppingMessagewith codeReplicationLiveIsStoppingMessage.LiveStopping.STOP_CALLEDand crashes before sending the second withReplicationLiveIsStoppingMessage.LiveStopping.FAIL_OVER.If the second message does come within this dead line, we fail over anyway.
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharedNothingBackupQuorum
public SharedNothingBackupQuorum(NodeManager nodeManager, ScheduledExecutorService scheduledPool, NetworkHealthCheck networkHealthCheck, int quorumSize, int voteRetries, long voteRetryWait, int quorumVoteWait, boolean failback)
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:Quorumthe name of the Quorum. this should be unique and is used to locate the correct quorum to use for voting
-
liveIDSet
public void liveIDSet(String liveID)
-
setQuorumManager
public void setQuorumManager(QuorumManager quorumManager)
Description copied from interface:Quorumcalled by the quorum manager when a quorum is registered- Specified by:
setQuorumManagerin interfaceQuorum
-
nodeDown
public void nodeDown(Topology topology, long eventUID, String nodeID)
if the node going down is the node we are replicating from then decide on an action.
-
nodeUp
public void nodeUp(Topology topology)
Description copied from interface:Quorumcalled by the quorum when a node in the quorum goes up
-
connectionFailed
public void connectionFailed(ActiveMQException exception, boolean failedOver)
if the connection to our replicated live goes down then decide on an action- Specified by:
connectionFailedin interfaceFailureListener
-
connectionFailed
public void connectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID)
- Specified by:
connectionFailedin interfaceFailureListener
-
beforeReconnect
public void beforeReconnect(ActiveMQException exception)
- Specified by:
beforeReconnectin interfaceSessionFailureListener
-
close
public void close()
Description copied from interface:Quorumcalled if the quorum manager is stopping so we can clean up
-
setSessionFactory
public void setSessionFactory(ClientSessionFactoryInternal sessionFactory)
- Parameters:
sessionFactory- the session factory used to connect to the live server
-
failOver
public void failOver(ReplicationLiveIsStoppingMessage.LiveStopping finalMessage)
Releases the latch, causing the backup activation thread to fail-over.The use case is for when the 'live' has an orderly shutdown, in which case it informs the backup that it should fail-over.
-
onBackupRegistrationFailed
public void onBackupRegistrationFailed(boolean alreadyReplicating)
- Specified by:
onBackupRegistrationFailedin interfaceLiveNodeLocator.BackupRegistrationListener
-
waitForStatusChange
public SharedNothingBackupQuorum.BACKUP_ACTIVATION waitForStatusChange()
Called by the replicating backup (i.e. "SharedNothing" backup) to wait for the signal to fail-over or to stop.- Returns:
- signal, indicating whether to stop or to fail-over
-
causeExit
public void causeExit(SharedNothingBackupQuorum.BACKUP_ACTIVATION explicitSignal)
Cause the Activation thread to exit and the server to be stopped.- Parameters:
explicitSignal- the state we want to set the quorum manager to return
-
reset
public void reset()
-
-