Class SharedNothingBackupQuorum
java.lang.Object
org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum
- All Implemented Interfaces:
SessionFailureListener,FailureListener,Quorum,NodeLocator.BackupRegistrationListener
public class SharedNothingBackupQuorum
extends Object
implements Quorum, SessionFailureListener, NodeLocator.BackupRegistrationListener
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThis is a safety net in case the primary sends the firstReplicationPrimaryIsStoppingMessagewith codeReplicationPrimaryIsStoppingMessage.PrimaryStopping.STOP_CALLEDand crashes before sending the second withReplicationPrimaryIsStoppingMessage.PrimaryStopping.FAIL_OVER. -
Constructor Summary
ConstructorsConstructorDescriptionSharedNothingBackupQuorum(NodeManager nodeManager, ScheduledExecutorService scheduledPool, NetworkHealthCheck networkHealthCheck, int quorumSize, int voteRetries, long voteRetryWait, int quorumVoteWait, boolean failback) -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeReconnect(ActiveMQException exception) Notifies that a connection has failed due to the specified 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 primary goes down then decide on an actionvoidconnectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) Notifies that a connection has failed due to the specified exception.voidfailOver(ReplicationPrimaryIsStoppingMessage.PrimaryStopping finalMessage) Releases the latch, causing the backup activation thread to fail-over.getName()the name of the Quorum. this should be unique and is used to locate the correct quorum to use for votingvoidif the node going down is the node we are replicating from then decide on an action.voidcalled by the quorum when a node in the quorum goes upvoidonBackupRegistrationFailed(boolean alreadyReplicating) voidprimaryIDSet(String primaryID) voidreset()voidsetQuorumManager(QuorumManager quorumManager) called by the quorum manager when a quorum is registeredvoidsetSessionFactory(ClientSessionFactoryInternal sessionFactory) Called by the replicating backup (i.e.
-
Field Details
-
WAIT_TIME_AFTER_FIRST_PRIMARY_STOPPING_MSG
public static final int WAIT_TIME_AFTER_FIRST_PRIMARY_STOPPING_MSGThis is a safety net in case the primary sends the firstReplicationPrimaryIsStoppingMessagewith codeReplicationPrimaryIsStoppingMessage.PrimaryStopping.STOP_CALLEDand crashes before sending the second withReplicationPrimaryIsStoppingMessage.PrimaryStopping.FAIL_OVER.If the second message does come within this dead line, we fail over anyway.
- See Also:
-
-
Constructor Details
-
SharedNothingBackupQuorum
public SharedNothingBackupQuorum(NodeManager nodeManager, ScheduledExecutorService scheduledPool, NetworkHealthCheck networkHealthCheck, int quorumSize, int voteRetries, long voteRetryWait, int quorumVoteWait, boolean failback)
-
-
Method Details
-
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 -
-
setQuorumManager
Description copied from interface:Quorumcalled by the quorum manager when a quorum is registered- Specified by:
setQuorumManagerin interfaceQuorum
-
nodeDown
if the node going down is the node we are replicating from then decide on an action. -
nodeUp
Description copied from interface:Quorumcalled by the quorum when a node in the quorum goes up -
connectionFailed
if the connection to our replicated primary goes down then decide on an action- Specified by:
connectionFailedin interfaceFailureListener- Parameters:
exception- exception which has caused the connection to fail
-
connectionFailed
public void connectionFailed(ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) Description copied from interface:FailureListenerNotifies that a connection has failed due to the specified exception.- Specified by:
connectionFailedin interfaceFailureListener- Parameters:
me- exception which has caused the connection to failscaleDownTargetNodeID- the ID of the node to which messages are scaling down
-
beforeReconnect
Description copied from interface:SessionFailureListenerNotifies that a connection has failed due to the specified exception.This method is called before the session attempts to reconnect/failover.
- Specified by:
beforeReconnectin interfaceSessionFailureListener- Parameters:
exception- exception which has caused the connection to fail
-
close
public void close()Description copied from interface:Quorumcalled if the quorum manager is stopping so we can clean up -
setSessionFactory
- Parameters:
sessionFactory- the session factory used to connect to the primary server
-
failOver
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 interfaceNodeLocator.BackupRegistrationListener
-
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
-
reset
public void reset()
-