You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2022/05/11 16:50:00 UTC

[GitHub] [helix] narendly commented on a diff in pull request #2082: Add TTL mode to async create API in ZkClient

narendly commented on code in PR #2082:
URL: https://github.com/apache/helix/pull/2082#discussion_r870541234


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java:
##########
@@ -1942,22 +1943,61 @@ public void asyncCreate(final String path, Object datat, final CreateMode mode,
 
   private void doAsyncCreate(final String path, final byte[] data, final CreateMode mode,
       final long startT, final ZkAsyncCallbacks.CreateCallbackHandler cb, final String expectedSessionId) {
+    try {
+      retryUntilConnected(() -> {
+        getExpectedZookeeper(expectedSessionId)
+            .create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, mode,
+                (AsyncCallback.StringCallback) cb,
+                new ZkAsyncRetryCallContext(_asyncCallRetryThread, cb, _monitor, startT, 0, false,
+                    GZipCompressionUtil.isCompressed(data)) {
+                  @Override
+                  protected void doRetry() {
+                    doAsyncCreate(path, data, mode, System.currentTimeMillis(), cb,
+                        expectedSessionId);
+                  }
+                });
+        return null;
+      });
+    } catch (RuntimeException e) {
+      // Process callback to release caller from waiting
+      cb.processResult(KeeperException.Code.APIERROR.intValue(), path,
+          new ZkAsyncCallMonitorContext(_monitor, startT, 0, false), null);
+      throw e;
+    }
+  }

Review Comment:
   It seems that this is just a formatting/style change. Am I missing anything here?



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