tisonkun commented on code in PR #453:
URL: https://github.com/apache/curator/pull/453#discussion_r1155235873
##########
curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java:
##########
@@ -770,14 +790,24 @@ static <T> void backgroundCreateParentsThenNode(final
CuratorFrameworkImpl clien
@Override
public void performBackgroundOperation(OperationAndData<T> dummy)
throws Exception
{
+ AtomicReference<CuratorEvent> event = new AtomicReference<>();
+ AsyncCallback.Create2Callback callback = new
AsyncCallback.Create2Callback()
+ {
+ @Override
+ public void processResult(int rc, String path, Object ctx,
String name, Stat stat)
+ {
+ event.set(createResponseEvent(client, rc, path, ctx,
name, stat));
+ }
+ };
try
{
- ZKPaths.mkdirs(client.getZooKeeper(), path, false,
aclProvider, createParentsAsContainers);
+ ZKPaths.mkdirs(client.getZooKeeper(), path, false,
aclProvider, createParentsAsContainers, callback);
}
catch ( KeeperException e )
{
if (
!client.getZookeeperClient().getRetryPolicy().allowRetry(e) )
{
+
client.processBackgroundOperation(mainOperationAndData, event.get());
Review Comment:
@kezhuw Thanks for your insight!
I checked that on exception, `stat` should be `null`, `ctx` we passed is
`null`, and since we don't create sequential node here, `path == name`. So
you're right that I can tidy the code a lot.
--
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]