public class LeaseLeaderElection extends Object implements LeaderElection<TableName>
LeaderElection.addStateListener(org.apache.hadoop.hive.metastore.leader.LeaderElection.LeadershipStateListener).LeaderElection.LeadershipStateListener| Modifier and Type | Field and Description |
|---|---|
static String |
METASTORE_RENEW_LEASE |
| Constructor and Description |
|---|
LeaseLeaderElection() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStateListener(LeaderElection.LeadershipStateListener listener)
Register listeners to get notified when leadership changes.
|
void |
close() |
long |
getLockId() |
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,
TableName table)
Place where election happens
|
public static final String METASTORE_RENEW_LEASE
public LeaseLeaderElection()
throws IOException
IOExceptionpublic void tryBeLeader(org.apache.hadoop.conf.Configuration conf,
TableName table)
throws LeaderException
LeaderElectiontryBeLeader in interface LeaderElection<TableName>conf - configurationtable - a global mutex for leader election.
It can be a path in Zookeeper, or a table that going to be locked.LeaderExceptionpublic void addStateListener(LeaderElection.LeadershipStateListener listener)
LeaderElectionaddStateListener in interface LeaderElection<TableName>listener - The listener to be addedpublic boolean isLeader()
LeaderElectionisLeader in interface LeaderElection<TableName>public void close()
close in interface Closeableclose in interface AutoCloseablepublic long getLockId()
public void setName(String name)
LeaderElectionsetName in interface LeaderElection<TableName>name - the namepublic String getName()
LeaderElectiongetName in interface LeaderElection<TableName>Copyright © 2024 The Apache Software Foundation. All rights reserved.