RFR: 8321561: (fs) Clarify non-atomic behavior of Files.move [v2]

Brian Burkhalter bpb at openjdk.org
Fri Jan 12 21:48:23 UTC 2024


On Fri, 12 Jan 2024 11:41:40 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8321561: Update verbiage instead of adding API note
>
> src/java.base/share/classes/java/nio/file/Files.java line 1363:
> 
>> 1361:      * If the {@code ATOMIC_MOVE} option is not specified, then the check for
>> 1362:      * an existing file and the actual move might not be atomic with respect
>> 1363:      * to other filesystem activities.
> 
> This looks quite good. A small suggestion is to replace "the check for an existing file" with "the check if the target file exists". The reason is that the other sentences use the phrase "target file exists" a few times.

Changed in 06732ccbdc4f0e39434eeee51b9a44c2d5a4b6b0.

> src/java.base/share/classes/java/nio/file/Files.java line 1414:
> 
>> 1412:      *          system operation, and a file is created at the target location
>> 1413:      *          between the existence check and actually moving the source
>> 1414:      *          <i>(optional specific exceptions)</i>
> 
> I think it might be better to split into two sentences. The second sentence could be "It may also be thrown when the REPLACE_EXISTING option is specified, the move is not atomic, and the target file is created by some other entity at around the same time that this method is called". Would that work for you?

So changed in 06732ccbdc4f0e39434eeee51b9a44c2d5a4b6b0.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17061#discussion_r1450953085
PR Review Comment: https://git.openjdk.org/jdk/pull/17061#discussion_r1450953128


More information about the nio-dev mailing list