Package io.atomix.raft.impl
Class RandomizedElectionTimer
java.lang.Object
io.atomix.raft.impl.RandomizedElectionTimer
- All Implemented Interfaces:
ElectionTimer
An implementation of the default election in raft. It uses a randomized timeout to prevent
multiple nodes from starting the election at the same time.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomizedElectionTimer(Duration electionTimeout, ThreadContext threadContext, Random random, Runnable triggerElection, org.slf4j.Logger log) -
Method Summary
-
Constructor Details
-
RandomizedElectionTimer
public RandomizedElectionTimer(Duration electionTimeout, ThreadContext threadContext, Random random, Runnable triggerElection, org.slf4j.Logger log)
-
-
Method Details
-
reset
public void reset()Description copied from interface:ElectionTimerReset the timerWhen `reset` is called, the previous timer is cancelled and a new timer will be started. After a specific duration, depending on the implementation, the election will be triggered.
- Specified by:
resetin interfaceElectionTimer
-
cancel
public void cancel()Description copied from interface:ElectionTimerCancel the timer- Specified by:
cancelin interfaceElectionTimer
-