0

For OS X there is no native WatchService implementation in the JDKs 7, 8 and 9. I would like to be able to use both the WatchService interface transparently and have native file watching instead of polling on OS X.

Is there a way I can provide a new WatchService for OS X? I would like to do this transparently instead of on every place where I ask for a WatchService with:

WatchService watcher = FileSystems.getDefault().newWatchService();

A suggested fix is to add the SensitivityWatchEventModifier.HIGH argument to calls to register. However, this value comes from sun packages and is only available on the Oracle JDK and I would prefer not to have such a dependency.

Community
  • 1
  • 1
Alessandro Vermeulen
  • 1,321
  • 1
  • 9
  • 28
  • Using what native code? – user207421 Apr 29 '16 at 11:09
  • @EJP: E.g. the [BarbaryWatchService](https://github.com/gjoseph/BarbaryWatchService/tree/master/src/main/java/com/barbarysoftware/watchservice) library has bindings to the native interface. If I could transparently add that it would be great. – Alessandro Vermeulen Apr 29 '16 at 12:12

0 Answers0