Class PendingWatcher
java.lang.Object
org.apache.hadoop.hbase.zookeeper.PendingWatcher
- All Implemented Interfaces:
org.apache.zookeeper.Watcher
Placeholder of a watcher which might be triggered before the instance is not yet created.
ZooKeeper
starts its event thread within its constructor (and that is an anti-pattern),
and the watcher passed to the constructor might be called back by the event thread before you get
the instance of ZooKeeper
from the constructor. If your watcher calls methods of
ZooKeeper
, pass this placeholder to the constructor of the ZooKeeper
, create your
watcher using the instance of ZooKeeper
, and then call the method
PendingWatcher.prepare
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
org.apache.zookeeper.Watcher.Event, org.apache.zookeeper.Watcher.WatcherType
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
pending
-
-
Constructor Details
-
PendingWatcher
-
-
Method Details
-
process
- Specified by:
process
in interfaceorg.apache.zookeeper.Watcher
-
prepare
Associates the substantial watcher of processing events. This method should be called once, andwatcher
should be non-null. This method is expected to call as soon as possible because the event processing, being invoked by the ZooKeeper event thread, is uninterruptibly blocked until this method is called.
-