문제

I can't reproduce the issue in a minor example, but is it possible to register two different WatchKeys for one Path if the WatchService and the Kind<?>s are the same?

For instance if the parent-directory content changes?

도움이 되었습니까?

해결책

Yes it is, if you cancel the old one before registering the second one.

Due to the fact, that pending events, if any, remain pending and may be retrieved by invoking the pollEvents method after the key is cancelled, this seems to be reasonable.

The cancelled WatchKey stays invalid forever though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top