Class RaftActorLeadershipTransferCohort
- java.lang.Object
-
- org.opendaylight.controller.cluster.raft.RaftActorLeadershipTransferCohort
-
public class RaftActorLeadershipTransferCohort extends Object
A raft actor support class that participates in leadership transfer. An instance is created upon initialization of leadership transfer.The transfer process is as follows:
- Send a LeaderStateChanged message with a null leader Id to the local RoleChangeNotifier to notify clients that we no longer have a working leader.
- Send a LeaderTransitioning message to each follower so each can send LeaderStateChanged messages to their local RoleChangeNotifiers.
- Call
RaftActor.pauseLeader(java.lang.Runnable)
passing this RaftActorLeadershipTransferCohort instance. This allows derived classes to perform work prior to transferring leadership. - When the pause is complete, the run method is called which in turn calls
Leader.transferLeadership(RaftActorLeadershipTransferCohort)
. - The Leader calls
transferComplete()
on successful completion. - Wait a short period of time for the new leader to be elected to give the derived class a chance to possibly complete work that was suspended while we were transferring.
- On notification of the new leader from the RaftActor or on time out, notify
RaftActorLeadershipTransferCohort.OnComplete
callbacks.
NOTE: All methods on this class must be called on the actor's thread dispatcher as they may access/modify internal state.
- Author:
- Thomas Pantelis
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortTransfer()
This method is invoked to abort leadership transfer on failure.Optional<String>
getRequestedFollowerId()
void
transferComplete()
This method is invoked when leadership transfer was carried out and complete.
-