@Deprecated @InterfaceAudience.Private public class ZKLeaderManager extends ZKListener
ZKLeaderManager to successfully create
 the given znode becomes the leader, allowing the instance to continue
 with whatever processing must be protected.  Other ZKLeaderManager
 instances will wait to be notified of changes to the leader znode.
 If the current master instance fails, the ephemeral leader znode will
 be removed, and all waiting instances will be notified, with the race
 to claim the leader znode beginning all over again.| Modifier and Type | Field and Description | 
|---|---|
| private Stoppable | candidateDeprecated.  | 
| private AtomicBoolean | leaderExistsDeprecated.  | 
| private String | leaderZNodeDeprecated.  | 
| private Object | lockDeprecated.  | 
| private static org.slf4j.Logger | LOGDeprecated.  | 
| private byte[] | nodeIdDeprecated.  | 
watcher| Constructor and Description | 
|---|
| ZKLeaderManager(ZKWatcher watcher,
               String leaderZNode,
               byte[] identifier,
               Stoppable candidate)Deprecated.  | 
| Modifier and Type | Method and Description | 
|---|---|
| private void | handleLeaderChange()Deprecated.  | 
| boolean | hasLeader()Deprecated.  | 
| void | nodeCreated(String path)Deprecated.  Called when a new node has been created. | 
| void | nodeDeleted(String path)Deprecated.  Called when a node has been deleted | 
| void | start()Deprecated.  | 
| void | stepDownAsLeader()Deprecated.  Removes the leader znode, if it is currently claimed by this instance. | 
| void | waitToBecomeLeader()Deprecated.  Blocks until this instance has claimed the leader ZNode in ZooKeeper | 
getWatcher, nodeChildrenChanged, nodeDataChangedprivate static final org.slf4j.Logger LOG
private final AtomicBoolean leaderExists
private final String leaderZNode
private final byte[] nodeId
public ZKLeaderManager(ZKWatcher watcher, String leaderZNode, byte[] identifier, Stoppable candidate)
public void start()
public void nodeCreated(String path)
ZKListenernodeCreated in class ZKListenerpath - full path of the new nodepublic void nodeDeleted(String path)
ZKListenernodeDeleted in class ZKListenerpath - full path of the deleted nodeprivate void handleLeaderChange()
public void waitToBecomeLeader()
public void stepDownAsLeader()
public boolean hasLeader()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.