TisonKun commented on a change in pull request #380:
URL: https://github.com/apache/curator/pull/380#discussion_r589448033



##########
File path: 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
##########
@@ -462,7 +484,12 @@ else if ( existingPath != null && mode.isSequential() )
             if ( localCreateMethod == null )
             {
                 CreateBuilderMain createBuilder = mode.isTTL() ? 
client.create().withTtl(ttl) : client.create();
-                CreateModable<ACLBackgroundPathAndBytesable<String>> 
tempCreateMethod = useProtection ? 
createBuilder.creatingParentContainersIfNeeded().withProtection() : 
createBuilder.creatingParentContainersIfNeeded();
+                CreateModable<ACLBackgroundPathAndBytesable<String>> 
tempCreateMethod;
+                if (useParentCreation) {
+                    tempCreateMethod = useProtection ? 
createBuilder.creatingParentContainersIfNeeded().withProtection() : 
createBuilder.creatingParentContainersIfNeeded();

Review comment:
       I found that this part of code is a bit awkward since our fluent api can 
flow only one directory and not quite fluent when one needs do configuration 
one by one. Is there a best practice for doing sth like
   
   ```
   if (useParentCreate) {
     tempCreateMethod = tempCreateMethod.creatingParentContainersIfNeeded();
   }
   if (useProtection) {
     tempCreateMethod = tempCreateMethod.withProtection();
   }
   ```




----------------------------------------------------------------
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.

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


Reply via email to