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


##########
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:
   Thank you for the suggestion, it makes sense and I made the 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