Class ActivationSequenceStateMachine
java.lang.Object
org.apache.activemq.artemis.core.server.impl.quorum.ActivationSequenceStateMachine
This class contains the activation sequence logic of the pluggable lock manager: it should be used by
ReplicationBackupActivation and
ReplicationPrimaryActivation to coordinate for replication.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanawaitNextCommittedActivationSequence(org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, String coordinatedLockAndNodeId, long activationSequence, long timeoutMills, Logger logger) It wait untiltimeoutMillis mshas passed or the coordinated activation sequence has progressed enoughstatic voidensureSequentialAccessToNodeData(String serverDescription, NodeManager nodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, Logger logger) This is going to increment the coordinated activation sequence and the local activation sequence (usingNodeManager.writeNodeActivationSequence(long)) while holding the primary lock, failing with some exception otherwise.static org.apache.activemq.artemis.lockmanager.DistributedLocktryActivate(NodeManager nodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, Logger logger) It loops if the data of the broker is still valuable, but cannot become active.
-
Method Details
-
tryActivate
public static org.apache.activemq.artemis.lockmanager.DistributedLock tryActivate(NodeManager nodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, Logger logger) throws InterruptedException, ExecutionException, TimeoutException, org.apache.activemq.artemis.lockmanager.UnavailableStateException It loops if the data of the broker is still valuable, but cannot become active. It loops (temporarily) if data is in sync or can auto-repair, but cannot yet acquire the primary lock.It stops loop and return:
null: if data is stale (and there are no rights to become active)!=null: if data is in sync/repaired and theDistributedLockis correctly acquired
ensureSequentialAccessToNodeData(java.lang.String, org.apache.activemq.artemis.core.server.NodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager, org.slf4j.Logger)to complete the activation and guarantee the initial not-replicated ownership of data.- Throws:
InterruptedExceptionExecutionExceptionTimeoutExceptionorg.apache.activemq.artemis.lockmanager.UnavailableStateException
-
awaitNextCommittedActivationSequence
public static boolean awaitNextCommittedActivationSequence(org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, String coordinatedLockAndNodeId, long activationSequence, long timeoutMills, Logger logger) throws ExecutionException, InterruptedException, TimeoutException, org.apache.activemq.artemis.lockmanager.UnavailableStateException It wait untiltimeoutMillis mshas passed or the coordinated activation sequence has progressed enough- Throws:
ExecutionExceptionInterruptedExceptionTimeoutExceptionorg.apache.activemq.artemis.lockmanager.UnavailableStateException
-
ensureSequentialAccessToNodeData
public static void ensureSequentialAccessToNodeData(String serverDescription, NodeManager nodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager distributedManager, Logger logger) throws ActiveMQException, InterruptedException, org.apache.activemq.artemis.lockmanager.UnavailableStateException, ExecutionException, TimeoutException This is going to increment the coordinated activation sequence and the local activation sequence (usingNodeManager.writeNodeActivationSequence(long)) while holding the primary lock, failing with some exception otherwise.This must be used while holding a primary lock to ensure not-exclusive ownership of data ie can be both used while loosing connectivity with a replica or after successfully
tryActivate(org.apache.activemq.artemis.core.server.NodeManager, org.apache.activemq.artemis.lockmanager.DistributedLockManager, org.slf4j.Logger).- Throws:
ActiveMQExceptionInterruptedExceptionorg.apache.activemq.artemis.lockmanager.UnavailableStateExceptionExecutionExceptionTimeoutException
-