System.out.println("watch service closed, terminating.");
break;
}
List<WatchEvent<?>> list;
Path watchedPath;
EventsStackerRunnable stacker;
synchronized (lock) {
synchronized (keyToPathLock) {
watchedPath = keyToPath.get(signalledKey);
}
if (watchedPath == null) {
continue;
}
// get list of events from key
list = signalledKey.pollEvents();
stacker = pathToStacker.get(watchedPath);
if (stacker == null) {
//if the stacker does not exist, go on without rescheduling the key!
if (log != null) {
log.append("Stacker for: ").appendObject(watchedPath).append("is null\n");
}
continue;
}
runnables.add(stacker);
for (WatchEvent<?> e : list) {
Path context = (Path) e.context();
Path resolve = watchedPath.resolve(context);
File file = new File(resolve.toString());
Kind<?> kind = e.kind();
if (log != null) {
log.append("Event: ").appendObject(e).append('\n');
}
if (kind == StandardWatchEventKind.OVERFLOW) {