简体   繁体   中英

java file system WatchService not picking up file when file is created by another java programm

I have implemented WatchService on file system directory. There is another java process which writes to this directory. When i manually create a file in directory, WatchService is able to pick that up but when another java process creates a file in that directory, WatchService is not able to pick that up. I'm using below sample code to write to a file.

 com.google.common.io.Files.write("test content".getBytes(), new File("/var/tmp/dir/1.txt"));

The problem was with the mounted NFS file system. Had to use Apache File Watcher API to resolve the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM