class PendingWatcher extends Object implements org.apache.zookeeper.Watcher
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.
| Modifier and Type | Field and Description |
|---|---|
private InstancePending<org.apache.zookeeper.Watcher> |
pending |
| Constructor and Description |
|---|
PendingWatcher() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
prepare(org.apache.zookeeper.Watcher watcher)
Associates the substantial watcher of processing events.
|
void |
process(org.apache.zookeeper.WatchedEvent event) |
private final InstancePending<org.apache.zookeeper.Watcher> pending
PendingWatcher()
public void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watchervoid prepare(org.apache.zookeeper.Watcher watcher)
watcher 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.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.