[英]java file system WatchService not picking up file when file is created by another java programm
I have implemented WatchService on file system directory. 我已经在文件系统目录上实现了WatchService。 There is another java process which writes to this directory.
还有另一个Java进程写入该目录。 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.
当我在目录中手动创建文件时,WatchService可以接收该文件,但是当另一个Java进程在该目录中创建文件时,WatchService则无法接收该文件。 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. 问题出在已挂载的NFS文件系统上。 Had to use Apache File Watcher API to resolve the issue.
必须使用Apache File Watcher API来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.