zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] eolivelli commented on a change in pull request #1106: ZOOKEEPER-1416 - Persistent, recursive watchers
Date Wed, 02 Oct 2019 22:17:22 GMT
eolivelli commented on a change in pull request #1106: ZOOKEEPER-1416 - Persistent, recursive
watchers
URL: https://github.com/apache/zookeeper/pull/1106#discussion_r330795488
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java
 ##########
 @@ -3028,6 +3112,77 @@ public void removeAllWatches(String path, WatcherType watcherType,
boolean local
         removeWatches(ZooDefs.OpCode.removeWatches, path, null, watcherType, local, cb, ctx);
     }
 
+    /**
+     * <p>
+     * Set a watcher on the given path that: a) does not get removed when triggered (i.e.
it stays active
+     * until it is removed); b) optionally applies not only to the registered path but all
child paths recursively. This watcher
+     * is triggered for both data and child events. To remove the watcher, use
+     * <tt>removeWatches()</tt> with <tt>WatcherType.Any</tt>
+     * </p>
+     *
+     * <p>
+     * If <tt>recursive</tt> is <tt>false</tt>, the watcher behaves
as if you placed an exists() watch and
+     * a getData() watch on the ZNode at the given path.
+     * </p>
+     *
+     * <p>
+     * If <tt>recursive</tt> is <tt>true</tt>, the watcher behaves
as if you placed an exists() watch and
+     * a getData() watch on the ZNode at the given path <strong>and</strong>
any ZNodes that are children
+     * of the given path including children added later.
+     * </p>
+     *
+     * <p>
+     * NOTE: when there are active recursive watches there is a small performance decrease
as all segments
+     * of ZNode paths must be checked for watch triggering.
+     * </p>
+     *
+     * @param basePath the top path that the watcher applies to
+     * @param watcher the watcher
+     * @param recursive if true applies not only to the registered path but all child paths
recursively including
+     *                  any child nodes added in the future
+     * @throws InterruptedException If the server transaction is interrupted.
+     * @throws KeeperException If the server signals an error with a non-zero
+     *  error code.
+     */
+    public void addPersistentWatch(String basePath, Watcher watcher, boolean recursive)
 
 Review comment:
   What about using an enum instead of a boolean for 'recursive'?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message