Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/590#discussion_r214962201
--- Diff: src/java/main/org/apache/zookeeper/server/watch/WatchManager.java
---
@@ -46,15 +48,26 @@
private final Map<Watcher, Set<String>> watch2Paths =
new HashMap<Watcher, Set<String>>();
- synchronized int size(){
+ @Override
+ public synchronized int size(){
int result = 0;
for(Set<Watcher> watches : watchTable.values()) {
result += watches.size();
}
return result;
}
- synchronized void addWatch(String path, Watcher watcher) {
+ boolean isDeadWatcher(Watcher watcher) {
--- End diff --
Yes, this also fixed the dead watch leaking issue in Watch Manager which
was found when I was building the new optimized watch manager.
---