Class Leader


  • public class Leader
    extends java.lang.Object
    Topic leader.

    Identified by the node identifier and a monotonically increasing term number. The term number is incremented by one every time a new node is elected as leader. Also available is the system clock time at the instant when this node was elected as leader. Keep in mind though that as with any system clock based time stamps this particular information susceptible to clock skew and should only be relied on for simple diagnostic purposes.

    • Constructor Summary

      Constructors 
      Constructor Description
      Leader​(NodeId nodeId, long term, long termStartTime)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      int hashCode()  
      NodeId nodeId()
      Returns the identifier for of leader.
      long term()
      Returns the leader's term.
      long termStartTime()
      Returns the system time when the current leadership term started.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Leader

        public Leader​(NodeId nodeId,
                      long term,
                      long termStartTime)
    • Method Detail

      • nodeId

        public NodeId nodeId()
        Returns the identifier for of leader.
        Returns:
        node identifier
      • term

        public long term()
        Returns the leader's term.
        Returns:
        leader term
      • termStartTime

        public long termStartTime()
        Returns the system time when the current leadership term started.
        Returns:
        current leader term start time
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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