Any native WatchService implementation planned on Mac OS X for JDK9?
Christopher Brown
christopherbrown06 at gmail.com
Wed Aug 20 14:20:37 UTC 2014
The Windows implementation seems to have a poller but doesn't seem to use
executors from what I can see (assuming I'm looking in the correct place):
http://cr.openjdk.java.net/~alanb/7006126/webrev.00/raw_files/new/src/windows/classes/sun/nio/fs/WindowsWatchService.java
The run() method at the end of that file invokes some
"GetQueuedCompletionStatus" function/method which seems to wake up on the
event. Maybe that's helpful to you, I'm not experienced in this area.
HTH,
Christopher
On 17 August 2014 16:26, Michael Hall <mik3hall at gmail.com> wrote:
> On Aug 9, 2014, at 4:57 PM, Christopher Brown <
> christopherbrown06 at gmail.com> 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
> https://github.com/bdkjones/VDKQueue
> 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)…
>
> http://cr.openjdk.java.net/~alanb/7006126/webrev.00/src/share/classes/sun/nio/fs/PollingWatchService.java.html
> 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 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/20140820/c38efe91/attachment.html>
More information about the nio-dev
mailing list