[英]Status of Java directory WatchService on MacOS
What is the status for WatchService on the Java platform for MacOS? MacOS 的 Java 平台上 WatchService 的状态如何?
Seems not to have been working on 7 and 8.似乎没有在 7 和 8 上工作。
Has that been resolved in later versions?后面的版本解决了吗? We are on 13 now.我们现在是13。
From what I can see, it's working on MacOS with OpenJDK 8.据我所知,它在 MacOS 上使用 OpenJDK 8。
/tmp$ java DirectoryWatcherExample
Event kind:ENTRY_CREATE. File affected: test.txt.
Event kind:ENTRY_DELETE. File affected: test.txt.
Event kind:ENTRY_CREATE. File affected: test.txt.
Event kind:ENTRY_MODIFY. File affected: test.txt.
Event kind:ENTRY_DELETE. File affected: test.txt.
/tmp$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
/tmp$ uname -v
Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12
~1/RELEASE_X86_64
You can try the code out DirectoryWatcherExample.java你可以试试看代码DirectoryWatcherExample.java
Original source: A guide to WatchService in Java NIO2原始来源: Java NIO2 中的 WatchService 指南
JDK seems to have the implementation of a mechanism called kevent which is the notification mechanism for OpenBSD/solaris based systems. JDK 似乎实现了一种称为kevent的机制,它是基于 OpenBSD/solaris 的系统的通知机制。 I have no experience with searching mercurial repos, so the best I can find is a readonly JDK8 source that shows the kqueue implementation.我没有搜索 mercurial 存储库的经验,所以我能找到的最好的是显示 kqueue 实现的只读 JDK8 源代码。
kevent
kevent
Macos 联机帮助页
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.