tisonkun commented on code in PR #453:
URL: https://github.com/apache/curator/pull/453#discussion_r1154606534


##########
curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java:
##########
@@ -333,26 +341,49 @@ public static void mkdirs(ZooKeeper zookeeper, String 
path, boolean makeLastNode
             String subPath = path.substring(0, pos);
             if ( zookeeper.exists(subPath, false) == null )
             {
-                try
+                List<ACL> acl = null;
+                if ( aclProvider != null )
                 {
-                    List<ACL> acl = null;
-                    if ( aclProvider != null )
-                    {
-                        acl = aclProvider.getAclForPath(subPath);
-                        if ( acl == null )
-                        {
-                            acl = aclProvider.getDefaultAcl();
-                        }
-                    }
+                    acl = aclProvider.getAclForPath(subPath);
                     if ( acl == null )
                     {
-                        acl = ZooDefs.Ids.OPEN_ACL_UNSAFE;
+                        acl = aclProvider.getDefaultAcl();
                     }
-                    zookeeper.create(subPath, new byte[0], acl, 
getCreateMode(asContainers));
                 }
-                catch ( KeeperException.NodeExistsException e )
+                if ( acl == null )
+                {
+                    acl = ZooDefs.Ids.OPEN_ACL_UNSAFE;
+                }
+
+                CompletableFuture<KeeperException> f = new 
CompletableFuture<>();
+
+                zookeeper.create(subPath, new byte[0], acl, 
getCreateMode(asContainers), new AsyncCallback.Create2Callback()
+                {
+                    @Override
+                    public void processResult(int rc, String path, Object ctx, 
String name, Stat stat)
+                    {
+                        if ( rc == KeeperException.Code.OK.intValue() )
+                        {
+                            f.complete(null);
+                            return;
+                        }
+
+                        if ( rc == KeeperException.Code.NODEEXISTS.intValue() )
+                        {
+                            // ignore... someone else has created it since we 
checked
+                            f.complete(null);
+                            return;
+                        }
+
+                        callback.processResult(rc, path, ctx, name, stat);
+                        
f.complete(KeeperException.create(KeeperException.Code.get(rc)));
+                    }
+                }, null);
+
+                KeeperException ke = f.join();

Review Comment:
   I'm not sure if we can still interrupt properly 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to