jackyfkc.github.io

教土豆学计算机

Watch

All of the read operations in ZooKeeper - getData(), getChildren(), and exists() - have the option of setting a watch as a side effect.

Here is ZooKeeper’s definition of a watch: a watch event is one-time trigger, sent to the client that set the watch, which occurs when the data for which the watch was set changes.

There are three key points to consider in this definition of a watch:

Watches are maintained locally at the ZooKeeper server to which the client is connected.

What ZooKeeper Guarantees about Watches

With regard to watches, ZooKeeper maintains these guarantees: