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


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -2396,12 +2395,17 @@ private void checkDataSizeLimit(String path, byte[] 
data) {
   }
 
   public void watchForData(final String path) {
-    watchForData(path, false);
+    watchForData(path, false, false);
   }
 
-  private boolean watchForData(final String path, boolean 
skipWatchingNonExistNode) {
+  public boolean watchForData(final String path, boolean 
skipWatchingNonExistNode, boolean persistListener) {
     try {
-      if (skipWatchingNonExistNode) {
+      if (persistListener) {
+        retryUntilConnected(() -> {
+          ((ZkConnection) getConnection()).getZookeeper().addWatch(path, 
AddWatchMode.PERSISTENT);
+          return true;

Review Comment:
   Not really, the `return true` is inside the lambda closure. We need to 
explicitly call return otherwise. Let's keep it as it is.



##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -2396,12 +2395,17 @@ private void checkDataSizeLimit(String path, byte[] 
data) {
   }
 
   public void watchForData(final String path) {
-    watchForData(path, false);
+    watchForData(path, false, false);
   }
 
-  private boolean watchForData(final String path, boolean 
skipWatchingNonExistNode) {
+  public boolean watchForData(final String path, boolean 
skipWatchingNonExistNode, boolean persistListener) {
     try {
-      if (skipWatchingNonExistNode) {
+      if (persistListener) {
+        retryUntilConnected(() -> {
+          ((ZkConnection) getConnection()).getZookeeper().addWatch(path, 
AddWatchMode.PERSISTENT);

Review Comment:
   sure, will add more comments



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