jihoonson commented on a change in pull request #11879:
URL: https://github.com/apache/druid/pull/11879#discussion_r743977179
##########
File path: core/src/main/java/org/apache/druid/java/util/common/FileUtils.java
##########
@@ -379,6 +379,27 @@ public static File createTempDir(@Nullable final String
prefix)
}
}
+ /**
+ * Create "directory" and all intermediate directories as needed. If the
directory is successfully created, or already
+ * exists, returns quietly. Otherwise, throws an IOException.
+ *
+ * Simpler to use than {@link File#mkdirs()}, and more reliable since it is
safe from races where two threads try
Review comment:
Oh, let me clarify myself. I do agree with discouraging use of
`File.mkdirs()`. I'm OK even with adding this new method. I'm just not sure
about the handling of race since letting multiple threads attempt to create the
same directory is probably not a good idea in most cases. Even though the fix
of the race is simple, I would not want to encourage such pattern unless it is
proven to be useful in some case.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]