@InterfaceAudience.Private public abstract class ZooKeeperListener extends java.lang.Object
ZooKeeperWatcher
for a process will execute the appropriate
methods of implementations of this class. In order to receive events from
the watcher, every listener must register itself via ZooKeeperWatcher.registerListener(org.apache.hadoop.hbase.zookeeper.ZooKeeperListener)
.
Subclasses need only override those methods in which they are interested.
Note that the watcher will be blocked when invoking methods in listeners so
they must not be long-running.Modifier and Type | Field and Description |
---|---|
protected ZooKeeperWatcher |
watcher |
Constructor and Description |
---|
ZooKeeperListener(ZooKeeperWatcher watcher)
Construct a ZooKeeper event listener.
|
Modifier and Type | Method and Description |
---|---|
ZooKeeperWatcher |
getWatcher() |
void |
nodeChildrenChanged(java.lang.String path)
Called when an existing node has a child node added or removed.
|
void |
nodeCreated(java.lang.String path)
Called when a new node has been created.
|
void |
nodeDataChanged(java.lang.String path)
Called when an existing node has changed data.
|
void |
nodeDeleted(java.lang.String path)
Called when a node has been deleted
|
protected ZooKeeperWatcher watcher
public ZooKeeperListener(ZooKeeperWatcher watcher)
public void nodeCreated(java.lang.String path)
path
- full path of the new nodepublic void nodeDeleted(java.lang.String path)
path
- full path of the deleted nodepublic void nodeDataChanged(java.lang.String path)
path
- full path of the updated nodepublic void nodeChildrenChanged(java.lang.String path)
path
- full path of the node whose children have changedpublic ZooKeeperWatcher getWatcher()