You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "xyuanlu (via GitHub)" <gi...@apache.org> on 2023/04/13 22:07:58 UTC

[GitHub] [helix] xyuanlu commented on a diff in pull request #2432: Use persist watcher for listener registration in ZkClient (when configured)

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


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -2921,10 +2988,47 @@ private void addChildListener(String path, IZkChildListener listener) {
     listeners.add(listener);
   }
 
+  private void addPersistListener(String path, Object listener) {
+    try {
+      _persistListenerMutex.lockInterruptibly();
+      if (listener instanceof IZkChildListener) {
+        addChildListener(path, (IZkChildListener) listener);
+      } else if (listener instanceof IZkDataListener) {
+        addDataListener(path, (IZkDataListener) listener);
+      }
+    } catch (InterruptedException ex) {
+      throw new ZkInterruptedException(ex);
+    } finally {
+      _persistListenerMutex.unlock();

Review Comment:
   TFTR. Good point. Will update. 



-- 
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: reviews-unsubscribe@helix.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org