You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "junkaixue (via GitHub)" <gi...@apache.org> on 2023/05/08 21:50:31 UTC

[GitHub] [helix] junkaixue commented on a diff in pull request #2465: Add exception for register ZK one time watcher when _usePersistWatcher flag is on

junkaixue commented on code in PR #2465:
URL: https://github.com/apache/helix/pull/2465#discussion_r1187926512


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -2152,6 +2173,13 @@ public <T extends Object> T readData(String path, Stat stat) {
 
   @SuppressWarnings("unchecked")
   public <T extends Object> T readData(final String path, final Stat stat, final boolean watch) {
+    // Throws exception when try to subscribe watch when using _usePersistWatcher. When ZkClient
+    // is subscribed as persist watcher, resubscribing the same object as onw time watcher will
+    // over write the persist watcher causing missing following event.
+    if (_usePersistWatcher && watch) {
+      throw new IllegalArgumentException(
+          "Can not subscribe one time watcher when ZkClient is using PersistWatcher");
+    }

Review Comment:
   Can we just wrap it with a private function for validation?



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