OS X watch service
mik3hall at gmail.com
Tue Dec 13 23:04:37 UTC 2016
> On Dec 13, 2016, at 4:27 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> Hello Michael,
> On Dec 10, 2016, at 6:55 AM, Michael Hall <mik3hall at gmail.com <mailto:mik3hall at gmail.com>> wrote:
>> I think I raised some of this long ago but I am looking at it again and it is sort of related to the PollingWatchService discussion that just came up on the list. As far as I know OS X is about the only platform using PollingWatchService. So I will raise the issue again.
> In addition to OS X, PollingWatchService is used on AIX and pre-11 versions of Solaris.
OK. I wasn’t aware of that.
>> 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…'.
>> 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  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 .
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.
Thanks for the response.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nio-dev