Which one of Linux, macOS, and Windows still don't have a native WatchService implementation?
Behrang Saeedzadeh
behrangsa at gmail.com
Wed Jul 22 07:20:37 UTC 2020
As it is mentioned in
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/nio/file/WatchService.html
:
*> The implementation that observes events from the file system is intended
to map directly on to the native file event notification facility where
available, or to use a primitive mechanism, such as polling, when a native
facility is not available. Consequently, many of the details on how events
are detected, their timeliness, and whether their ordering is preserved are
highly implementation specific. For example, when a file in a watched
directory is modified then it may result in a single ENTRY_MODIFY
<https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/nio/file/StandardWatchEventKinds.html#ENTRY_MODIFY>
event
in some implementations but several events in other implementations.
Short-lived files (meaning files that are deleted very quickly after they
are created) may not be detected by primitive implementations that
periodically poll the file system to detect changes. *
Does OpenJDK use a native implementation on any of Linux, macOS, and
Windows operating systems?
>From memory Java 8 on OS X didn't have a native implementation but things
might have changed since then.
I was thinking about writing a native implementation for those that don't
and create a pull request to add it to OpenJDK.
--
Best regards,
Behrang Saeedzadeh
More information about the discuss
mailing list