OS X watch service

Brian Burkhalter brian.burkhalter at oracle.com
Wed Dec 14 00:42:14 UTC 2016

On Dec 13, 2016, at 3:04 PM, Michael Hall <mik3hall at gmail.com> wrote:

>>> I had tried to write a native OS X watch service based on UKKQueue. […]
>> Without some study I could not at this point write anything of substance on the alternatives you discuss.
> I’ve raised the issue on the Cocoa dev list as well without any response there either. 
> What I have seems at least a working implementation with the one exception that I currently know of with the seeming deadlock where kqueue stops posting events during the re-poll in the LotsOfEvents test. Actually during the initial poll as well but there events that have processed prior to that so it doesn’t immediately fail.
> I have been unable to come up with any idea why java code waiting on this poll causes the kernel code to stop working like this, and I haven’t yet had any suggestions as to what might cause this.
> My code was based on looking at existing implementations. It includes an internal Poller class I think based on the SolarisWatchService. I know that has waits that do not hang kqueue.
> Something extending or based on the PollingWatchService was sort of an idea given I simply currently can’t resolve the kqueue stoppage. I guess I keep raising the issue every now and then hoping
> some kqueue expert will say, ‘well, you can get a kqueue stoppage because…’.

As noted, I don’t have the knowledge as yet to make any substantive comment.

>>> So, I guess I am, at this point,  simply throwing this out for any suggestions, concerns, thoughts - these would be appreciated. One reason I didn’t keep going before is there really didn’t seem to be that much interest. So just indicating that would be good in making it seem worth the effort.
>> There is definitely interest in this topic. There is for example a nearly five year old issue on file [1] to create a kqueue-based WatchService as you are suggesting.
>> Note that if you are interested in becoming an OpenJDK contributor it would be worth perusing [2].
> My current thought is just a working 3rd party implementation. Given that, if there was interest, I would of course be very pleased if the jdk would consider doing anything based on it. 
> It might at least provide a demo for how something might be done for the OS X platform. The PollingWatchService is probably perfectly fine for almost all uses but there could be 
> more specialized interest in a native implementation.

The JDK team is happy to accept contributions from external developers as long as things adhere to the process in place for this. As noted we have been aware of the need for a kqueue-based implementation here and would like to see some movement on it, probably once the JDK 9 efforts wind down to a degree at least.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20161213/10309b65/attachment-0001.html>

More information about the nio-dev mailing list