Class QuorumManager
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager
-
- All Implemented Interfaces:
ClusterTopologyListener,ActiveMQComponent
public final class QuorumManager extends Object implements ClusterTopologyListener, ActiveMQComponent
-
-
Constructor Summary
Constructors Constructor Description QuorumManager(ExecutorService threadPool, ClusterController clusterController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxClusterSize()returns the maximum size this cluster has been.voidhandleQuorumVote(Channel clusterChannel, Packet packet)booleanhasLive(String nodeID, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit)booleanisStarted()are we startedbooleanisStillLive(String nodeID, TransportConfiguration liveConnector, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit)voidnodeDown(long eventUID, String nodeID)notify theQuorumof a topology change.voidnodeUP(TopologyMember topologyMember, boolean last)called by theServerLocatorInternalwhen the topology changes.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 locatorStringtoString()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, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
-
-
-
Constructor Detail
-
QuorumManager
public QuorumManager(ExecutorService threadPool, ClusterController clusterController)
-
-
Method Detail
-
start
public void start() throws Exceptionwe start by simply creating the server locator and connecting in a separate thread- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
stop
public void stop() throws Exceptionstops the server locator- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
isStarted
public boolean isStarted()
are we started- Specified by:
isStartedin interfaceActiveMQComponent- Returns:
-
registerQuorum
public void registerQuorum(Quorum quorum)
registers aQuorumso that it can be notified of changes in the cluster.- Parameters:
quorum-
-
unRegisterQuorum
public void unRegisterQuorum(Quorum quorum)
unregisters aQuorum.- Parameters:
quorum-
-
nodeUP
public void nodeUP(TopologyMember topologyMember, boolean last)
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
public void nodeDown(long eventUID, String nodeID)notify theQuorumof a topology change.- Specified by:
nodeDownin interfaceClusterTopologyListener- Parameters:
eventUID-nodeID- the id of the node leaving the cluster
-
hasLive
public boolean hasLive(String nodeID, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit)
-
isStillLive
public boolean isStillLive(String nodeID, TransportConfiguration liveConnector, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit)
-
getMaxClusterSize
public int getMaxClusterSize()
returns the maximum size this cluster has been.- Returns:
- max size
-
vote
public void vote(QuorumVote quorumVote)
ask the quorum to vote within a specific quorum.- Parameters:
quorumVote- the vote to acquire
-
registerQuorumHandler
public void registerQuorumHandler(QuorumVoteHandler quorumVoteHandler)
called to register vote handlers on the quorum- Parameters:
quorumVoteHandler- the vote handler
-
-