RFR: 8288627: [AIX] Implement WatchService using system library
Alan Bateman
alanb at openjdk.org
Fri Jul 8 07:57:43 UTC 2022
On Thu, 7 Jul 2022 16:47:22 GMT, Tyler Steele <tsteele at openjdk.org> wrote:
> > Calling Files means you are calling the API from the provider which will be problematic if the default provider is configured to be something else.
>
> I debated creating and using an instance of AixFileSystem directly. It didn't seem like it would be worth the trouble, but I'm open to changing that opinion. If this code is somehow being run on a non-AIX machine, I'm sure this would not be their only issue. There is another complication if we go this route: createDirectories is implemented in Files.java, so using createDirectory from AixFileSystem would mean duplicating this functionality in my implementation.
It is "architectural broken" to call back into the API from the implementation. It may not be visible now but it will surface once you run in environments where the default file system provider is replaced.
> I'm sure you're right. I didn't think too hard about the Security Manager since it is now depreciated. I agree that there are a few places that would cause issues. If preferred, I am happy to work in any changes necessary to support it.
SecurityManager may be terminally deprecated but it's still a supported execution mode so the new code will need to work with a SM.
> This is tricky, since the loops examine values in the c-struct. Without a StructLayout object or some other way of examining values in foreign memory, I'm not sure how to do this in a clean way. Maybe there is a solution for manipulating c-structs in Java that I am not aware of; the way to do this that I am familiar with is currently a preview API (JEP-424).
There are many examples in the NIO implementation that access the fields in structs from Java code. In the Linux implementation of WatchService you'll see it access the inotify_event structure directly. In time I expect new code will make more use of the new Panama APIs and maybe some of the existing code will be migrated.
-------------
PR: https://git.openjdk.org/jdk/pull/9281
More information about the nio-dev
mailing list