RFR: 8202110: (fs) Default file system provider should load UnixNativeDispatcher lazily

Alan Bateman alanb at openjdk.org
Wed Mar 22 14:14:49 UTC 2023


On Tue, 21 Mar 2023 23:31:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Initialize `needToResolveAgainstDefaultDirectory` instance variable lazily thereby deferring early use of `UnixNativeDispatcher` and hopefully loading `libnio`.

src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 123:

> 121:                 this.needToResolveAgainstDefaultDirectory = !defaultIsCwd;
> 122:             }
> 123:         }

Making needToResolveAgainstDefaultDirectory a tri-state is a bit ugly. If we really need to defer this then it might be better to just move the field to Holder class, that way this method would return holder.needToResolveAgainstDefaultDirectory.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13132#discussion_r1144879997


More information about the nio-dev mailing list