If watchkey.reset() returns false that means state is invalid.
Because documentation wrote:A watch key has a state. At any given time, its state might be one of the following:
http://docs.oracle.com/javase/tutorial/ ... ation.html
- Ready indicates that the key is ready to accept events. When first created, a key is in the ready state.
- Signaled indicates that one or more events are queued. Once the key has been signaled, it is no longer in the ready state until the reset method is invoked.
- Invalid indicates that the key is no longer active. This state happens when one of the following events occurs:
- The process explicitly cancels the key by using the cancel method.
- The directory becomes inaccessible.
- The watch service is closed.