WatchService
Wolfgang Baltes
wolfgang.baltes at laposte.net
Wed Jan 12 06:17:47 PST 2011
On 2011-01-12 02:43, Alan Bateman wrote:
>
>
> One thing I should have mentioned before is that our Windows
> WatchService implementation supports an implementation specific
> modifier that allows you to monitor a file tree with a single
> registration. If you want to try it out do this:
>
> register(watcher,
> new WatchEvent.Kind<?>[]{ ENTRY_DELETE },
> com.sun.nio.file.ExtendedWatchEventModifier.FILE_TREE);
>
> With this modifier then you only register the top directory and the
> context for each event is the relative path from the top directory.
> It's not a portable solution and only works on Windows but it would be
> interesting to how it compares.
>
I'll try this out and let you know the result.
>> - For ENTRY_MODIFY, the 8.3 form of the directory name is used
>> instead of the long form. Of all the tests done so far, this is the
>> first where a name is long enough for this to happen. => This prompts
>> me to wonder whether there is a method in Path that allows to get the
>> long form, given the 8.3 form, and conversely the 8.3 form given the
>> long form?
> That is a good point as our implementation does not convert events for
> 8.3 names into long names (which might be problematic with delete
> events). I'm curious how you generated these events. Were you in CMD
> or COMMAND or maybe you monitored the file using the 8.3 form explicitly?
>
I just use the standard Command Prompt window; that is,
%windir%\system32\cmd.exe. No special settings. And no, I did not use
the 8.3 form at all. It just popped up and I thought that this was an
interesting inconsistency because the ENTRY_DELETE line that follows
uses the long name.
Wolfgang.
More information about the nio-dev
mailing list