On Tue, 13 Apr 2021 20:26:56 GMT, Andy Herrick <herr...@openjdk.org> wrote:

>> src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java line 59:
>> 
>>> 57: 
>>> 58:     public static void deleteRecursive(Path directory) throws 
>>> IOException {
>>> 59:         final IOException [] exception = { (IOException) null };
>> 
>> Do we know `Files.walkFileTree()` synchronizes calls on callback object? If 
>> not, I'd use `AtomicReference` to store the first exception.
>
> That seems like overkill.  walkFileTree must call visitFile, 
> preVisitDirectory, and postVisitDirectory synchronously, because their return 
> value tells walkFileTree where to go next.

I can use AtomicReference instead of Array to hold the IOException, but must I 
lock around access, there is no "setIfNull()" method

-------------

PR: https://git.openjdk.java.net/jdk/pull/3473

Reply via email to