T - the type of mutexpublic interface LeaderElection<T> extends Closeable
LeaderElection.LeadershipStateListener
before election happens.| Modifier and Type | Interface and Description |
|---|---|
static interface |
LeaderElection.LeadershipStateListener |
| Modifier and Type | Method and Description |
|---|---|
void |
addStateListener(LeaderElection.LeadershipStateListener listener)
Register listeners to get notified when leadership changes.
|
String |
getName()
Get the name of this leader candidate
|
boolean |
isLeader()
Getting the result of election.
|
void |
setName(String name)
Set the name of this leader candidate
|
void |
tryBeLeader(org.apache.hadoop.conf.Configuration conf,
T mutex)
Place where election happens
|
void tryBeLeader(org.apache.hadoop.conf.Configuration conf,
T mutex)
throws LeaderException
conf - configurationmutex - a global mutex for leader election.
It can be a path in Zookeeper, or a table that going to be locked.LeaderExceptionboolean isLeader()
void addStateListener(LeaderElection.LeadershipStateListener listener)
listener - The listener to be addedvoid setName(String name)
name - the nameString getName()
Copyright © 2024 The Apache Software Foundation. All rights reserved.