JDK-8259873: (fs) Add java.nio.file.attribute.BasicWithKeyFileAttributeView interface
Alan Bateman
Alan.Bateman at oracle.com
Wed Jan 20 08:14:31 UTC 2021
On 20/01/2021 07:55, Martin Buchholz wrote:
> I'm mostly cheerleading here, and haven't developed for Windows in
> many years, but ... I agree with the strategy here. More use of file
> keys would benefit performance on all platforms. OTOH I worry that
> filekeys are inconsistently implemented on different OSes and filesystems.
>
The recent thread with subject line "Files.isSameFile(Path,Path)" may be
useful to re-read. The JDK has been using the volume serial number and
file indexes but they are problematic on some volumes (not guarantee to
be unique, maybe be zero). The Microsoft folks here have been looking to
replace the usage with the "full path" (the approximate equivalent to
realpath).
We did a lot work in JDK 7 to make the default case (not following sym
links) be efficient on Windows. This is the reason for the internal
BasicFileAttribuetHolder that FileTreeWalker uses to avoid needing to
read the file attributes. Maybe we could lean on that internal interface
and try to find options there before adding to the standard API.
Switching from FindFirstFile/FindNextFile to NtQueryDirectoryInformation
is definitely worth exploring, it will just take significant time to
review and will likely go through a few review iterations.
-Alan
More information about the nio-dev
mailing list