WatchService

Alan Bateman Alan.Bateman at oracle.com
Thu Jan 20 05:59:59 PST 2011


Wolfgang Baltes wrote:
>
> Hi Alan,
>
> thanks again for this tip. I modified the WatchDir program to use the 
> suggested Windows-specific registration. This works as expected: when 
> deleting a file tree using Windows Explorer, then I only get an event 
> for the directory being removed (no event for any file or subdirectory 
> contained therein). When using rmdir from the command prompt, then I 
> get events for each item.
>
> When adding/creating a subtree, then I get events for all items.
>
> Will this modifier remain in the final version of JDK7, or is it only 
> experimental and may get removed?
Thanks for trying out that modifier. The reason it is there is to test 
out the ability to extend this part of the API with provider specific 
capabilities. My guess is that we'll need to look at this area some time 
(not jdk7 but maybe later) to see if it makes sense to add a standard 
modifier or some means to watch directories recursively. This may be 
insane in some environments but it is clear that some people are trying 
to use it this way. The hard part is dealing with errors and issues that 
arise on platforms where this isn't supported natively. I just mention 
this as one reason why this provider specific modifier could go away.

-Alan


More information about the nio-dev mailing list