WatchService - Exposing more of the Inotify Event Model

Alan Bateman Alan.Bateman at oracle.com
Sat Oct 2 02:33:33 PDT 2010


fm wrote:
> I've modified a few of the WatchService implementation classes to
> allow for the registration of additional WatchEvent.Kind instances
> that represent the native events of the underlying OS platform. I
> believe the changes add flexibility to the WatchService API, with
> minimal disruptive code changes to the existing implementation. There
> should be a negligible impact on the existing performance. I have
> altered the implementation of the LinuxWatchService to support the
> additional event model; however, the SolarisWatchService and
> WindowsWatchService implementations are effectively unchanged and
> should work the same as before. Similar modifications could be made to
> these WatchService implementations to also expose their native event
> models.
>
> I am completely open to hearing comments on if this type of added
> flexibility to the WatchService API is appropriate for the JDK 7 or
> better left to an ex
> ternal project.
>
> I will gladly provide the source code files for evaluation if there is
> interest. Modified files are AbstractWatchKey.java,
> AbstractPoller.java, LinuxWatchService.java, and one new file
> LinuxWatchEventKind.java.
>
> Regards
>   
Sorry for the delay getting back to you on this.  It should be fine to 
send the patch here but we can't accept changes unless you are a 
contributor [1].

As regards the changes, I'm a bit surprised that you needed to change 
AbstractWatchKey as it doesn't know about specific events. For 
AbstractPoller then we probably need to reorganize to that it allows 
non-standard events through to be registered.

-Alan.

[1] http://openjdk.java.net/contribute/


More information about the nio-dev mailing list