Class Follower
java.lang.Object
org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
org.opendaylight.controller.cluster.raft.behaviors.Follower
- All Implemented Interfaces:
AutoCloseable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
final @NonNull Follower
copy()
final String
Returns the id of the leader.final short
Returns the leader's payload data version.handleMessage
(org.apache.pekko.actor.ActorRef sender, Object message) Handle a message.protected final void
setLeaderId
(@Nullable String leaderId) protected final void
setLeaderPayloadVersion
(short leaderPayloadVersion) Methods inherited from class org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
getReplicatedToAllIndex, raftRole, setReplicatedToAllIndex
-
Constructor Details
-
Follower
-
-
Method Details
-
copy
-
getLeaderId
Description copied from class:RaftActorBehavior
Returns the id of the leader.- Specified by:
getLeaderId
in classRaftActorBehavior
- Returns:
- the id of the leader or null if not known
-
setLeaderId
-
getLeaderPayloadVersion
public final short getLeaderPayloadVersion()Description copied from class:RaftActorBehavior
Returns the leader's payload data version.- Specified by:
getLeaderPayloadVersion
in classRaftActorBehavior
- Returns:
- a short representing the version
-
setLeaderPayloadVersion
protected final void setLeaderPayloadVersion(short leaderPayloadVersion) -
handleMessage
Description copied from class: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.- Overrides:
handleMessage
in classRaftActorBehavior
- Parameters:
sender
- The sender of the messagemessage
- A message that needs to be processed- Returns:
- The new behavior or current behavior, or null if the message was not handled.
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classRaftActorBehavior
-