tisonkun commented on code in PR #1859:
URL: https://github.com/apache/zookeeper/pull/1859#discussion_r1125239144
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchManager.java:
##########
@@ -232,49 +249,49 @@ public synchronized void dumpWatches(PrintWriter pwriter,
boolean byPath) {
@Override
public synchronized boolean containsWatcher(String path, Watcher watcher) {
- WatcherMode watcherMode = watcherModeManager.getWatcherMode(watcher,
path);
- PathParentIterator pathParentIterator = getPathParentIterator(path);
- for (String localPath : pathParentIterator.asIterable()) {
- Set<Watcher> watchers = watchTable.get(localPath);
- if (!pathParentIterator.atParentPath()) {
- if (watchers != null) {
- return true; // at the leaf node, all watcher types
match
- }
- }
- if (watcherMode.isRecursive()) {
- return true;
- }
- }
- return false;
+ Set<Watcher> list = watchTable.get(path);
Review Comment:
@kezhuw Can you explain a bit why this change is correct?
It seems that previously, `containsWatcher (path, watcher)` will be `true`
if any parent of the path has a persistent recursive watch.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]