Any native WatchService implementation planned on Mac OS X for JDK9?

Michael Hall mik3hall at
Sun Aug 17 14:26:36 UTC 2014

On Aug 9, 2014, at 4:57 PM, Christopher Brown <christopherbrown06 at> wrote:

> If there are licencing issues, maybe a standalone watcher would be enough?  Looking at the command line you used, I get the impression that you had to reimplement a significant par of the API (Paths and stuff) for this service (and other Mac-specific stuff).

Still looking at this a little bit. I haven't figured out the KQueue issues yet but I was thinking of trying with
Apparently this is a updated version of UKKQueue which I based mine on. I thought maybe going with the notification communication (I think UKKQueue did this too but I changed it), instead of a JNI callback might work. 

Another alternative did occur to me after looking at that a little bit for what might be a really simple 'real time' WatchService with minimal changes.
That code included…
[[NSWorkspace sharedWorkspace] noteFileSystemChanged:fpath];

In looking at the API documentation I thought this was sort of deprecated in favor of FSEvents.
However, as long as it's there couldn't you use that to signal a change and then post the polling watch service to 'wakeup' immediately and process any changes?
Looking a little bit at the polling code (not sure if totally current)…
that has…

                // create the periodic task
 290                 Runnable thunk = new Runnable() { public void run() { poll(); }};
 291                 this.poller = scheduledExecutor
 292                     .scheduleAtFixedRate(thunk, period, period, TimeUnit.SECONDS);

I haven't gotten into Executor's yet in any of my java. Is there any way to cause that to fire immediately? Or otherwise externally fire an immediate non-scheduled poll()? 
The big knock on the Polling code seems to be that it is polling, not that it doesn't handle changes correctly or quickly enough. Wouldn't this address that and still mostly rely on the current licensed and supported code. 

Anyhow, I might try to see if I can include something like that as another 'watch service' with my code. 

Michael Hall

trz nio.2 for OS X

HalfPipe Java 6/7 shell app

AppConverter convert Apple jvm to openjdk apps

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nio-dev mailing list