Class Leadership


  • public class Leadership
    extends java.lang.Object
    State of leadership for topic.

    Provided by this construct is the current leader and the list of nodeIds currently registered as candidates for election for the topic. Keep in mind that only registered candidates can become leaders.

    • Constructor Summary

      Constructors 
      Constructor Description
      Leadership​(java.lang.String topic, Leader leader, java.util.List<NodeId> candidates)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<NodeId> candidates()
      Returns an preference-ordered list of nodes that are in the leadership race for this topic.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      Leader leader()
      Returns the leader for this topic.
      NodeId leaderNodeId()
      Returns the nodeId of the leader.
      java.lang.String topic()
      Returns the leadership topic.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Leadership

        public Leadership​(java.lang.String topic,
                          Leader leader,
                          java.util.List<NodeId> candidates)
    • Method Detail

      • topic

        public java.lang.String topic()
        Returns the leadership topic.
        Returns:
        leadership topic.
      • leaderNodeId

        public NodeId leaderNodeId()
        Returns the nodeId of the leader.
        Returns:
        leader node identifier; will be null if there is no leader
      • leader

        public Leader leader()
        Returns the leader for this topic.
        Returns:
        leader; will be null if there is no leader for topic
      • candidates

        public java.util.List<NodeId> candidates()
        Returns an preference-ordered list of nodes that are in the leadership race for this topic.
        Returns:
        a list of NodeIds in priority-order, or an empty list.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object