kevinrr888 commented on code in PR #5732:
URL: https://github.com/apache/accumulo/pull/5732#discussion_r2200909487


##########
server/base/src/main/java/org/apache/accumulo/server/manager/LiveTServerSet.java:
##########
@@ -211,10 +213,23 @@ static class TServerInfo {
   // The set of entries in zookeeper without locks, and the first time each 
was noticed
   private final Map<ServiceLockPath,Long> locklessServers = new HashMap<>();
 
-  public LiveTServerSet(ServerContext context, Listener cback) {
-    this.cback = cback;
+  public LiveTServerSet(ServerContext context) {
+    this.cback = new AtomicReference<>(null);
     this.context = context;
-    this.context.getZooCache().addZooCacheWatcher(this);
+  }
+
+  public void setCback(Listener cback) {

Review Comment:
   The synchronization would handle many threads calling this method, allowing 
only one to execute at a time. If 3 threads call this method, 1 will acquire 
the lock disallowing the other 2 from executing the same code block at the same 
time. Once thread 1 completes, the other 2 can try to get the lock and do the 
same thing.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to