Skip to content
Advertisement

Which filesystems provide native support for Java’s WatchService?

I want to use the Java WatchService in an IDE-like tool. It seems like a good match for the behaviors I need from it.

The trick is that my customers use the tool in all sorts of interesting environments. Most of the time, the files are on the local disk, but often the files will be on some mounted network drive. Often these are in complex enterprise environments with proxies and VPNs in the mix too.

Before I invest too much time implementing a WatchService solution, I would like some reassurance that it’s likely to work in these complex environments.

For example:

  • Windows shared drives
  • Sharepoint mapped network drives
  • Clearcase dynamic/static views
  • VMWare mounted drives (viewed from the client or viewed from the host)
  • Samba based mounted drives

Is there a maintained list of filesystems that do (or do not) provide native file change events to the Java WatchService?

As a corollary, is there data describing the functional and non-functional performance WatchService’s polling implementation in scenarios like this?

Advertisement

Answer

Regarding ClearCase and WatchService:

  • a snapshot view would work, considering it is simply a folder on your regular local drive
  • a dynamic view is to be tested, as it is the combination of a network view (MFVS: MultiVersion File System ) and a (generally) local view store (regular folder, for the private or checked out elements)

And it was reported before (2012, so it might have improved since then) that “Java 7 WatchService does not generate events when registered directory is on a network drive“.

As mentioned in 2019:

If a watched file is not located on a local storage device then it is implementation specific if changes to the file can be detected.
In particular, it is not required that changes to files carried out on remote systems be detected.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement