WatchKey#PollEvents() returning more events than expected

Tony Childs tony.childs at gmail.com
Wed Jul 2 09:11:48 PDT 2008


I've been listening to the Google Talks
presentation<http://video.google.com/videoplay?docid=-3975461488578314796>on
NIO.2 and reading through the
PDF <http://openjdk.java.net/projects/nio/presentations/TS-5686.pdf> that
Alan posted.  Upon testing code similar to that on page 22 of the PDF, I
noticed unexpected (to me) behavior.  When watching a directory and then
adding a space to a text file and then saving it, WatchKey#PollEvents()
returns two ENTRY_MODIFY events that seem identical but are actually copies
of each other.  Any idea why there would be two?  Also, when I create a new
file, in the watched directory, pollEvents() initially returns one
ENTRY_CREATE event and then a subsequent call returns three more events:
ENTRY_DELETE, ENTRY_CREATE, and ENTRY_MODIFY.  I'm confused as to why there
are so many events for a seemly simple operation?

Thanks,
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20080702/3a14d1d0/attachment.html 


More information about the nio-discuss mailing list