Hi Stu,

The zk server maintains 2 lists of watches, data and child watches:
(after reviewing this doc I've entered a jira to clarify that the server is maintaining 2 lists being referenced). From the server perspective if you register a watch on a node by calling getData & exists, only a single watch, a data watch, is stored by the server.

The client is maintaining lists of watches as well. This is essentially to enable the auto watch reset and multi-watcher features added in v3.

Take a look at class ExistsWatchRegistration, it will register client side dataWatches for exists calls -- unless the result code is not 0 (ie NONODE), in which case it will register using existsWatches (again, client side).

The comment you referenced in your original email is true - that code should never execute as the existsWatches list only contains watches for NONODE watch registrations (which obv couldn't be deleted since it doesn't exist).

Hope this helps,


Stu Hood wrote:
I'm running the 3.0.0 release, and I'm receiving a warning thrown by this block 
of code:
case NodeDeleted:
    synchronized (dataWatches) {
        addTo(dataWatches.remove(path), result);
    // XXX This shouldn't be needed, but just in case
    synchronized (existWatches) {
        addTo(existWatches.remove(path), result);
        LOG.warn("We are triggering an exists watch for delete! Shouldn't 
    synchronized (childWatches) {
        addTo(childWatches.remove(path), result);


Why shouldn't an exists watch be triggered by a node being deleted? That is a 
really common use case in my code, so I want to rule it out as the cause of a 
bug I'm hunting for.


Stu Hood
Architecture Software Developer
Mailtrust, a Division of Rackspace

Reply via email to