keith-turner commented on code in PR #5256:
URL: https://github.com/apache/accumulo/pull/5256#discussion_r1917168228
##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ZooCache.java:
##########
@@ -152,53 +189,53 @@ public void process(WatchedEvent event) {
break;
}
- externalWatcher.ifPresent(w -> w.accept(event));
+ externalWatchers.forEach(ew -> ew.accept(event));
}
}
- /**
- * Creates a new cache without an external watcher.
- *
- * @param zk the ZooKeeper instance
- * @throws NullPointerException if zk is {@code null}
- */
- public ZooCache(ZooSession zk) {
- this(zk, Optional.empty(), Duration.ofMinutes(3));
+ public ZooCache(ZooSession zk, String root, ZooCacheWatcher... watchers) {
+ this.zk = requireNonNull(zk);
+ for (ZooCacheWatcher zcw : watchers) {
+ externalWatchers.add(zcw);
+ }
+ setupWatchers(requireNonNull(root));
Review Comment:
@ctubbsii these watchers are being setup once. What impact will ZooSession
creating a new zookeeper have on these watchers? The way zoocache used to work
it was alway adding new watches after a disconnect event so maybe it was ok w/
a new zookeeper being created, not completely sure about this case now though.
--
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]