public interface ILeaderElector extends Closeable
The interface for leader election.
| Modifier and Type | Method and Description |
|---|---|
void |
addToLeaderLockQueue()
queue up for leadership lock.
|
void |
close()
Method called to allow for cleanup.
|
List<NimbusInfo> |
getAllNimbuses() |
NimbusInfo |
getLeader() |
boolean |
isLeader() |
void |
prepare(Map conf)
Method guaranteed to be called as part of initialization of leader elector instance.
|
void |
removeFromLeaderLockQueue()
Removes the caller from the leader lock queue.
|
void prepare(Map conf)
Method guaranteed to be called as part of initialization of leader elector instance.
conf - configurationvoid addToLeaderLockQueue()
throws Exception
queue up for leadership lock. The call returns immediately and the caller must check isLeader() to perform any leadership action. This method can be called multiple times so it needs to be idempotent.
Exceptionvoid removeFromLeaderLockQueue()
throws Exception
Removes the caller from the leader lock queue. If the caller is leader also releases the lock. This method can be called multiple times so it needs to be idempotent.
Exceptionboolean isLeader()
throws Exception
ExceptionNimbusInfo getLeader()
List<NimbusInfo> getAllNimbuses() throws Exception
Exceptionvoid close()
Method called to allow for cleanup. once close this object can not be reused.
close in interface AutoCloseableclose in interface CloseableCopyright © 2022 The Apache Software Foundation. All Rights Reserved.