OS X kqueue based WatchService

Michael Hall mik3hall at gmail.com
Wed Jun 19 15:39:12 PDT 2013


I had done some OS X nio.2 coding for my trz package, see below.
This had included a kqueue implementation of a WatchService to possibly use instead of the built-in polling one.
It passed the Basic nio.2 WatchService tests but not the LotsOfEvents one. 
I decided to see if I could get it to put some more time into it, first trying to get it passing the LotsOfEvents test. I changed it in a way that I thought would work but am running into an issue I'm not sure how to address. 
For brevity without throwing in lots of code snippets and debug message logs it goes something like.
The kqueue native should run on it's own thread. The LotsOfEvents test polls the WatchService with the AbstractWatchService timer invocation. After the first timer expires it processes keys until none and then attempts to timer poll again. 
For some reason from the time the first poll expires to the time the first attempted re-poll expires the code seems to do nothing to keep the process alive.
A span of about 3 seconds with nothing happening, not even one native event loop running on it's own thread. (Appears to be sitting in the kevent call).
Prior to this the kqueue native code is processing events at a rate of about 12 events per second.
Why does the native code seem blocked in the critical part of the test?

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20130619/013d6c74/attachment.html 


More information about the nio-dev mailing list