@InterfaceAudience.Private public abstract class ZooKeeperListener extends 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(String path)
Called when an existing node has a child node added or removed.
|
void |
nodeCreated(String path)
Called when a new node has been created.
|
void |
nodeDataChanged(String path)
Called when an existing node has changed data.
|
void |
nodeDeleted(String path)
Called when a node has been deleted
|
protected ZooKeeperWatcher watcher
public ZooKeeperListener(ZooKeeperWatcher watcher)
public void nodeCreated(String path)
path
- full path of the new nodepublic void nodeDeleted(String path)
path
- full path of the deleted nodepublic void nodeDataChanged(String path)
path
- full path of the updated nodepublic void nodeChildrenChanged(String path)
path
- full path of the node whose children have changedpublic ZooKeeperWatcher getWatcher()
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.