RFR: 8293067: (fs) Implement WatchService using system library (macOS) [v3]

Maxim Kartashev mkartashev at openjdk.org
Thu Sep 22 07:10:25 UTC 2022


On Tue, 20 Sep 2022 20:59:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Maxim Kartashev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Removed the change unnecessary without recursive watch
>
> src/java.base/macosx/classes/sun/nio/fs/MacOSXWatchService.java line 399:
> 
>> 397:                 }
>> 398: 
>> 399:                 final int flags = unsafe.getInt(eventFlagsPtr);
> 
> This looks like the only use of `Unsafe`. Could the objective be accomplished without using it, e.g., changing `long eventFlagsPtr` to a `long[]` or, maybe even simpler, a `boolean[]`?

Earlier on the mailing list @AlanBateman wrote "It would help the review if the native code is just simple wrappers about the FSEvents as we'll likely replace a lot of the JNI code in this area in time." 
I understood that as a suggestion to keep the native code as simple as possible and, conversely, do as much as possible on the Java side. Reading native memory here was one of the decisions that were based on that understanding. 
I may have, of course, read too much into it, so I'm not opposed to implementing your suggestion. I would like, however, to have a confirmation that this direction of the changes is OK with @AlanBateman also.

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

PR: https://git.openjdk.org/jdk/pull/10140


More information about the nio-dev mailing list