tisonkun commented on code in PR #453:
URL: https://github.com/apache/curator/pull/453#discussion_r1154600433
##########
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()
Review Comment:
The callback-completable-future-mixed style is not quite elegant, but this
is the best solution I find now.
--
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]