Вопрос

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