qqu0127 commented on code in PR #2432:
URL: https://github.com/apache/helix/pull/2432#discussion_r1171749866


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -135,6 +138,8 @@ public class ZkClient implements Watcher {
   private ZkClientMonitor _monitor;
   private boolean _usePersistWatcher;
 
+  private ReentrantLock _persistListenerMutex;

Review Comment:
   nit: can this be final?



##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -2927,4 +2990,54 @@ private void removeChildListener(String path, 
IZkChildListener listener) {
       listeners.remove(listener);
     }
   }
+
+  interface ManipulateListener<T> {
+    void run() throws KeeperException, InterruptedException;
+  }

Review Comment:
   Do we still need this? Can we simply use Runnable?



##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -1313,7 +1354,7 @@ private void fireAllEvents(WatchedEvent event) {
    * are deleted before the last page is fetched. The upstream caller should 
be able to handle this.
    */
   public List<String> getChildren(String path) {
-    return getChildren(path, hasListeners(path));
+    return getChildren(path, (hasListeners(path) && !_usePersistWatcher));

Review Comment:
   check `_usePersistWatcher` first, this should save some computation!



##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -1785,7 +1826,7 @@ public void run() throws Exception {
                 }
                 try {
                   // TODO: the data is redundantly read multiple times when 
multiple listeners exist
-                  data = readData(path, null, true);
+                  data = readData(path, null, false); ///true);

Review Comment:
   cleanup the unused change?



-- 
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]

Reply via email to