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
IOException
public boolean isLeader()
public String getName()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void takeLeadership(org.apache.curator.framework.CuratorFramework client) throws Exception
takeLeadership
in interface org.apache.curator.framework.recipes.leader.LeaderSelectorListener
Exception
public void stateChanged(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.state.ConnectionState newState)
stateChanged
in interface org.apache.curator.framework.state.ConnectionStateListener
public void setCurrentMasterThread(Thread currentMasterThread)
currentMasterThread
- Copyright © 2014. All rights reserved.