You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by "tisonkun (via GitHub)" <gi...@apache.org> on 2023/03/31 15:13:59 UTC
[GitHub] [curator] tisonkun commented on a diff in pull request #453: CURATOR-665: ZKPaths.mkdirs should complete background on exception
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: commits-unsubscribe@curator.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org