Class NonLeaderRole

java.lang.Object
io.permazen.kv.raft.Role
io.permazen.kv.raft.NonLeaderRole
Direct Known Subclasses:
CandidateRole, FollowerRole

public abstract class NonLeaderRole extends Role
Support superclass for the follower and candidate roles, both of which have an election timer.
  • Method Details

    • getElectionTimeout

      public Timestamp getElectionTimeout()
      Get the election timer deadline, if currently running.

      For a follower that is not a member of its cluster, this will return null because no election timer is running. For all other cases, this will return the time at which the election timer expires.

      Returns:
      current election timer expiration deadline, or null if not running
    • startElection

      public void startElection()
      Force an immediate election timeout.
      Throws:
      IllegalStateException - if this role is no longer active or election timer is not running