ZooKeeper.WatchRegistration (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper

## Class ZooKeeper.WatchRegistration

- java.lang.Object
- - org.apache.zookeeper.ZooKeeper.WatchRegistration

- Enclosing class:
    ZooKeeper

      public abstract static class ZooKeeper.WatchRegistration
      extends Object

  Register a watcher for a particular path.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WatchRegistration(Watcher watcher, String clientPath)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract Map<String,Set<Watcher>>` | `getWatches(int rc)`
    `void` | `register(int rc)` Register the watcher with the set of watches on path.
    `protected boolean` | `shouldAddWatch(int rc)` Determine whether the watch should be added based on return code.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WatchRegistration

          public WatchRegistration(Watcher watcher,
                                   String clientPath)

  - ### Method Detail

    - #### getWatches

          protected abstract Map<String,Set<Watcher>> getWatches(int rc)

    - #### register

          public void register(int rc)

      Register the watcher with the set of watches on path.
      Parameters:
        `rc` - the result code of the operation that attempted to add the watch on the path.

    - #### shouldAddWatch

          protected boolean shouldAddWatch(int rc)

      Determine whether the watch should be added based on return code.
      Parameters:
        `rc` - the result code of the operation that attempted to add the watch on the node
      Returns:
        true if the watch should be added, otw false

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.