Is Java 7 WatchService Slow for Anyone Else? Is Java 7 WatchService Slow for Anyone Else? java java

Is Java 7 WatchService Slow for Anyone Else?


I have much better response times if I change

folder.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY);

to

folder.register(watcher, new WatchEvent.Kind[]{StandardWatchEventKinds.ENTRY_MODIFY}, SensitivityWatchEventModifier.HIGH);


JDK 7 does not yet have a native implementation of WatchService for MacOS. Rather than listening for native file system events, it uses the fallback sun.nio.fs.PollingWatchService, which periodically traverses the file system and checks the last modified timestamp of each file and subdirectory in the tree. I've also found it to be unusably slow.

There is a native implementation of WatchService for Mac:

http://code.google.com/p/barbarywatchservice/

I haven't tried to use it myself.