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
A QourumManager can be used to register a Quorum to receive notifications about changes to the cluster. A Quorum can then issue a vote to the remaining nodes in a cluster for a specific outcome
  • Constructor Details

  • Method Details

    • start

      public void start() throws Exception
      we start by simply creating the server locator and connecting in a separate thread
      Specified by:
      start in interface ActiveMQComponent
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      stops the server locator
      Specified by:
      stop in interface ActiveMQComponent
      Throws:
      Exception
    • isStarted

      public boolean isStarted()
      are we started
      Specified by:
      isStarted in interface ActiveMQComponent
    • registerQuorum

      public void registerQuorum(Quorum quorum)
      registers a Quorum so that it can be notified of changes in the cluster.
    • unRegisterQuorum

      public void unRegisterQuorum(Quorum quorum)
      unregisters a Quorum.
    • nodeUP

      public void nodeUP(TopologyMember topologyMember, boolean last)
      called by the ServerLocatorInternal when the topology changes. we update the maxClusterSize if needed and inform the Quorum's.
      Specified by:
      nodeUP in interface ClusterTopologyListener
      Parameters:
      topologyMember - the topolgy changed
      last - if the whole cluster topology is being transmitted (after adding the listener to the cluster connection) this parameter will be true for the last topology
    • nodeDown

      public void nodeDown(long eventUID, String nodeID)
      notify the Quorum of a topology change.
      Specified by:
      nodeDown in interface ClusterTopologyListener
      Parameters:
      nodeID - the id of the node leaving the cluster
    • hasPrimary

      public boolean hasPrimary(String nodeID, int quorumSize, int voteTimeout, TimeUnit voteTimeoutUnit)
    • 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

      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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • handleQuorumVote

      public void handleQuorumVote(Channel clusterChannel, Packet packet)