Any interest in WatchService based on MacOS FSEvents?
Marius Volkhart
marius at volkhart.com
Tue Aug 30 23:21:41 UTC 2022
Hi Maxim,
I think this would be great, and would be very pleased to see it in the JDK.
Cheers,
Marius
> On Aug 30, 2022, at 02:52, Maxim Kartashev <maxim.kartashev at jetbrains.com> wrote:
>
>
> WatchService on MacOS is still implemented by the generic PollingWatchService, which continuously re-scans the directory consuming CPU, introduces large latencies to the generated WatchEvent's, and misses changes that occur faster than the re-scan interval. At the same time, there are two technologies available on the platform to receive the necessary information from the OS similar to what is available on Windows and Linux: Kernel Queues and File System Events, the latter being more suitable for implementing the WatchServie functionality.
>
> There are several stand-alone implementations out there that utilize one or the other (or even both), which suggests that demand exists for WatchService on MacOS to be more responsive and less resource-hungry.
>
> If the community is interested in getting this functionality in OpenJDK proper, I'd be happy to contribute code that was developed, tested, and used at JetBrains for around half a year. It is based on FSEvents, supports the FILE_TREE modifier (recursive directory watch), and does not do any excessive I/O except the necessary minimum.
>
> References
> * WatchService interface
> - https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/nio/file/WatchService.html
> * PollingWatchService source code
> - https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java
> * File System Events
> - https://developer.apple.com/documentation/coreservices/file_system_events?language=objc
> * Kernel Queues
> - https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/FSEvents_ProgGuide/KernelQueues/KernelQueues.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/discuss/attachments/20220830/fd994f9a/attachment-0001.htm>
More information about the discuss
mailing list