日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

JAVA实现inotify一样的功能_哪些操作系统支持在Java中查看本机(类似inotify)文件

發布時間:2025/4/17 windows 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JAVA实现inotify一样的功能_哪些操作系统支持在Java中查看本机(类似inotify)文件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

JavaDoc for java.nio.file.WatchService狀態;

The implementation … 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.

我認為這意味著它將嘗試一種輕量級的本機機制(如Linux上的inotify),如果不能,則進行輪詢.

那是對的嗎?

哪些操作系統可能或不可能提供這樣的設施? Linux的發行版級別真的很有用,或者我可以假設如果JVM在* unix上運行,它會受到支持嗎?

解決方法:

這應該是一個評論,但它太大了,不能發布它…

我正在查看jdk-9源代碼(也可以在jdk-8 repo中輕松搜索),但這里有一些與你的問題評論有關:

/**

* Linux implementation of WatchService based on inotify.

*

* In summary a background thread polls inotify plus a socket used for the wakeup

* mechanism. Requests to add or remove a watch, or close the watch service,

* cause the thread to wakeup and process the request. Events are processed

* by the thread which causes it to signal/queue the corresponding watch keys.

*/

class LinuxWatchService extends AbstractWatchService

對于Windows:

/*

* Win32 implementation of WatchService based on ReadDirectoryChangesW.

*/

class WindowsWatchService extends AbstractWatchService

等等..您可以在以下位置找到所有可用的實現:

jdk/src/java.base/{windows|unix|solaris|linux...}/classes/sun/nio/fs/

正如操作系統實際上支持這一點,似乎需要您查看實際的發行版.

標簽:java,linux,java-8,raspberry-pi,inotify

來源: https://codeday.me/bug/20190527/1164337.html

總結

以上是生活随笔為你收集整理的JAVA实现inotify一样的功能_哪些操作系统支持在Java中查看本机(类似inotify)文件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。