Class Candidate
java.lang.Object
org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
org.opendaylight.controller.cluster.raft.behaviors.Candidate
- All Implemented Interfaces:
AutoCloseable
The behavior of a RaftActor when it is in the Candidate raft state.
Candidates (ยง5.2):
- On conversion to candidate, start election:
- Increment currentTerm
- Vote for self
- Reset election timer
- Send RequestVote RPCs to all other servers
- If votes received from majority of servers: become leader
- If AppendEntries RPC received from new leader: convert to follower
- If election timeout elapses: start new election
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Returns the id of the leader.short
Returns the leader's payload data version.handleMessage
(org.apache.pekko.actor.ActorRef sender, Object message) Handle a message.Methods inherited from class org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior
getReplicatedToAllIndex, raftRole, setReplicatedToAllIndex
-
Method Details
-
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
-
getLeaderPayloadVersion
public 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
-
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 void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classRaftActorBehavior
-