Issue with WatchService on Mac OS 10.9.1 using Oracle JDK 1.7.0_51

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 15 11:55:48 PST 2014


On 15/01/2014 19:39, Christian Schlichtherle wrote:
> Hi Alan,
>
> well, it seems to work reliably now. However, I still think it’s a bug: From the moment the call to directory.register(…) returns, the watch service should monitor all changes and this is only a single change of the file size and modification time. Introducing a call to Thread.sleep(…) should only be a workaround.
>
This is how it already works, the modification time is captured when you 
register and it is polled in the background after that. It's just that 
the granularity of the timestamps aren't good enough in the OS X 
implementation (we have nano-second support on other platforms but not 
OS X).

The suggestion of putting the sleep after you create the file was just 
to demonstrate this point, I'm not of course suggesting to leave that in :-)

-Alan


More information about the nio-discuss mailing list