public interface ILeaderElector extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
addToLeaderLockQueue()
queue up for leadership lock.
|
boolean |
awaitLeadership(long timeout,
TimeUnit timeUnit)
Wait for the caller to gain leadership.
|
void |
close()
Method called to allow for cleanup.
|
List<NimbusInfo> |
getAllNimbuses()
Get list of current nimbus addresses.
|
NimbusInfo |
getLeader()
Get the current leader's address.
|
boolean |
isLeader()
Decide if the caller currently has the leader lock.
|
void |
prepare(Map<String,Object> conf)
Method guaranteed to be called as part of initialization of leader elector instance.
|
void |
quitElectionFor(int delayMs)
Removes the caller from leadership election, relinquishing leadership if acquired, then requeues for leadership after the specified
delay.
|
void prepare(Map<String,Object> conf)
conf - configurationvoid addToLeaderLockQueue()
throws Exception
Exceptionvoid quitElectionFor(int delayMs)
throws Exception
delayMs - The delay to wait before re-entering the electionExceptionboolean isLeader()
throws Exception
ExceptionNimbusInfo getLeader()
boolean awaitLeadership(long timeout,
TimeUnit timeUnit)
throws InterruptedException
InterruptedExceptionList<NimbusInfo> getAllNimbuses() throws Exception
Exceptionvoid close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2023 The Apache Software Foundation. All rights reserved.