qqu0127 commented on code in PR #2432:
URL: https://github.com/apache/helix/pull/2432#discussion_r1172859057
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -384,6 +405,21 @@ public void unsubscribeStateChanges(
}
public void unsubscribeAll() {
+ if (_usePersistWatcher) {
+ ManipulateListener removeAllListeners = () -> {
+ Set<String> paths = new HashSet<>();
+ _childListener.forEach((k, v) -> paths.add(k));
+ _dataListener.forEach((k, v) -> paths.add(k));
Review Comment:
This may have some memory overhead.
Will this be better with Stream.concat(s1.stream(), s2.stream()).forEach()?
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -384,6 +405,21 @@ public void unsubscribeStateChanges(
}
public void unsubscribeAll() {
+ if (_usePersistWatcher) {
+ ManipulateListener removeAllListeners = () -> {
+ Set<String> paths = new HashSet<>();
+ _childListener.forEach((k, v) -> paths.add(k));
+ _dataListener.forEach((k, v) -> paths.add(k));
+ paths.forEach(p -> {
+ try {
+ getConnection().removeWatches(p, this, WatcherType.Any);
+ } catch (InterruptedException | KeeperException e) {
+ LOG.info("Failed to remove persistent watcher for {} ", p, e);
Review Comment:
This should be error
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]