Example #1
0
 /** Register the given directory with the WatchService */
 private void register(Path dir) throws IOException {
   WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
   if (trace) {
     Path prev = keys.get(key);
     if (prev == null) {
       System.out.format("register: %s\n", dir);
     } else {
       if (!dir.equals(prev)) {
         System.out.format("update: %s -> %s\n", prev, dir);
       }
     }
   }
   keys.put(key, dir);
 }