public class LeaderSelectorClient extends Object implements Closeable, org.apache.curator.framework.recipes.leader.LeaderSelectorListener
| Constructor and Description |
|---|
LeaderSelectorClient(String zookeeperAddress,
String electionPath,
String leaderPath,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
getName() |
List<String> |
getParticipants() |
boolean |
isLeader() |
void |
setCurrentMasterThread(Thread currentMasterThread)
Set the current master thread.
|
void |
start() |
void |
stateChanged(org.apache.curator.framework.CuratorFramework client,
org.apache.curator.framework.state.ConnectionState newState) |
void |
takeLeadership(org.apache.curator.framework.CuratorFramework client) |
public void start()
throws IOException
IOExceptionpublic boolean isLeader()
public String getName()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void takeLeadership(org.apache.curator.framework.CuratorFramework client)
throws Exception
takeLeadership in interface org.apache.curator.framework.recipes.leader.LeaderSelectorListenerExceptionpublic void stateChanged(org.apache.curator.framework.CuratorFramework client,
org.apache.curator.framework.state.ConnectionState newState)
stateChanged in interface org.apache.curator.framework.state.ConnectionStateListenerpublic void setCurrentMasterThread(Thread currentMasterThread)
currentMasterThread - Copyright © 2014. All rights reserved.