@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.watcher| 构造器和说明 |
|---|
ZKLeaderManager(ZKWatcher watcher,
String leaderZNode,
byte[] identifier,
Stoppable candidate)
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
hasLeader()
已过时。
|
void |
nodeCreated(String path)
已过时。
Called when a new node has been created.
|
void |
nodeDeleted(String path)
已过时。
Called when a node has been deleted
|
void |
start()
已过时。
|
void |
stepDownAsLeader()
已过时。
Removes the leader znode, if it is currently claimed by this instance.
|
void |
waitToBecomeLeader()
已过时。
Blocks until this instance has claimed the leader ZNode in ZooKeeper
|
getWatcher, nodeChildrenChanged, nodeDataChangedpublic void start()
public void nodeCreated(String path)
ZKListenernodeCreated 在类中 ZKListenerpath - full path of the new nodepublic void nodeDeleted(String path)
ZKListenernodeDeleted 在类中 ZKListenerpath - full path of the deleted nodepublic void waitToBecomeLeader()
public void stepDownAsLeader()
public boolean hasLeader()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.