java.lang.Object
org.opendaylight.controller.cluster.raft.behaviors.AbstractRaftActorBehavior
org.opendaylight.controller.cluster.raft.behaviors.Follower
All Implemented Interfaces:
AutoCloseable, RaftActorBehavior

public class Follower extends AbstractRaftActorBehavior
The behavior of a RaftActor in the Follower raft state.
  • Respond to RPCs from candidates and leaders
  • If election timeout elapses without receiving AppendEntries RPC from current leader or granting vote to candidate: convert to candidate
  • Constructor Details

  • Method Details

    • getLeaderId

      public final String getLeaderId()
      Description copied from interface: RaftActorBehavior
      Returns the id of the leader.
      Returns:
      the id of the leader or null if not known
    • setLeaderId

      protected final void setLeaderId(@Nullable String leaderId)
    • getLeaderPayloadVersion

      public short getLeaderPayloadVersion()
      Description copied from interface: RaftActorBehavior
      Returns the leader's payload data version.
      Returns:
      a short representing the version
    • setLeaderPayloadVersion

      protected final void setLeaderPayloadVersion(short leaderPayloadVersion)
    • handleAppendEntries

      protected RaftActorBehavior handleAppendEntries(ActorRef sender, AppendEntries appendEntries)
      Description copied from class: AbstractRaftActorBehavior
      Derived classes should not directly handle AppendEntries messages it should let the base class handle it first. Once the base class handles the AppendEntries message and does the common actions that are applicable in all RaftState's it will delegate the handling of the AppendEntries message to the derived class to do more state specific handling by calling this method
      Specified by:
      handleAppendEntries in class AbstractRaftActorBehavior
      Parameters:
      sender - The actor that sent this message
      appendEntries - The AppendEntries message
      Returns:
      a new behavior if it was changed or the current behavior
    • handleAppendEntriesReply

      protected RaftActorBehavior handleAppendEntriesReply(ActorRef sender, AppendEntriesReply appendEntriesReply)
      Description copied from class: AbstractRaftActorBehavior
      Derived classes should not directly handle AppendEntriesReply messages it should let the base class handle it first. Once the base class handles the AppendEntriesReply message and does the common actions that are applicable in all RaftState's it will delegate the handling of the AppendEntriesReply message to the derived class to do more state specific handling by calling this method
      Specified by:
      handleAppendEntriesReply in class AbstractRaftActorBehavior
      Parameters:
      sender - The actor that sent this message
      appendEntriesReply - The AppendEntriesReply message
      Returns:
      a new behavior if it was changed or the current behavior
    • handleRequestVoteReply

      protected RaftActorBehavior handleRequestVoteReply(ActorRef sender, RequestVoteReply requestVoteReply)
      Description copied from class: AbstractRaftActorBehavior
      Derived classes should not directly handle RequestVoteReply messages it should let the base class handle it first. Once the base class handles the RequestVoteReply message and does the common actions that are applicable in all RaftState's it will delegate the handling of the RequestVoteReply message to the derived class to do more state specific handling by calling this method
      Specified by:
      handleRequestVoteReply in class AbstractRaftActorBehavior
      Parameters:
      sender - The actor that sent this message
      requestVoteReply - The RequestVoteReply message
      Returns:
      a new behavior if it was changed or the current behavior
    • handleMessage

      public RaftActorBehavior handleMessage(ActorRef sender, Object message)
      Description copied from interface: RaftActorBehavior
      Handle a message. If the processing of the message warrants a state change then a new behavior should be returned otherwise this method should return the current behavior.
      Specified by:
      handleMessage in interface RaftActorBehavior
      Overrides:
      handleMessage in class AbstractRaftActorBehavior
      Parameters:
      sender - The sender of the message
      message - A message that needs to be processed
      Returns:
      The new behavior or current behavior, or null if the message was not handled.
    • close

      public void close()