Class QuorumManager
java.lang.Object
org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager
- All Implemented Interfaces:
ClusterTopologyListener,ActiveMQComponent
public final class QuorumManager
extends Object
implements ClusterTopologyListener, ActiveMQComponent
-
Constructor Summary
ConstructorsConstructorDescriptionQuorumManager(ExecutorService threadPool, ClusterController clusterController) -
Method Summary
Modifier and TypeMethodDescriptionintReturns the maximum size this cluster has been.voidhandleQuorumVote(Channel clusterChannel, Packet packet) booleanhasPrimary(String nodeID, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit) booleanare we startedbooleanisStillActive(String nodeID, TransportConfiguration connector, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit) voidnotify theQuorumof a topology change.voidnodeUP(TopologyMember topologyMember, boolean last) called by theServerLocatorInternalwhen the topology changes. we update themaxClusterSizeif needed and inform theQuorum's.voidregisterQuorum(Quorum quorum) registers aQuorumso that it can be notified of changes in the cluster.voidregisterQuorumHandler(QuorumVoteHandler quorumVoteHandler) called to register vote handlers on the quorumvoidstart()we start by simply creating the server locator and connecting in a separate threadvoidstop()stops the server locatortoString()voidunRegisterQuorum(Quorum quorum) unregisters aQuorum.voidvote(QuorumVote quorumVote) ask the quorum to vote within a specific quorum.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
Constructor Details
-
QuorumManager
-
-
Method Details
-
start
we start by simply creating the server locator and connecting in a separate thread- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
stop
stops the server locator- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
isStarted
public boolean isStarted()are we started- Specified by:
isStartedin interfaceActiveMQComponent
-
registerQuorum
registers aQuorumso that it can be notified of changes in the cluster. -
unRegisterQuorum
unregisters aQuorum. -
nodeUP
called by theServerLocatorInternalwhen the topology changes. we update themaxClusterSizeif needed and inform theQuorum's.- Specified by:
nodeUPin interfaceClusterTopologyListener- Parameters:
topologyMember- the topolgy changedlast- if the whole cluster topology is being transmitted (after adding the listener to the cluster connection) this parameter will betruefor the last topology
-
nodeDown
notify theQuorumof a topology change.- Specified by:
nodeDownin interfaceClusterTopologyListener- Parameters:
nodeID- the id of the node leaving the cluster
-
hasPrimary
-
isStillActive
public boolean isStillActive(String nodeID, TransportConfiguration connector, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit) -
getMaxClusterSize
public int getMaxClusterSize()Returns the maximum size this cluster has been.- Returns:
- the maximum size this cluster has been
-
vote
ask the quorum to vote within a specific quorum.- Parameters:
quorumVote- the vote to acquire
-
registerQuorumHandler
called to register vote handlers on the quorum- Parameters:
quorumVoteHandler- the vote handler
-
toString
-
handleQuorumVote
-