code: private void register(Path dir) throws IOException {
  //        WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_MODIFY);
          WatchKey key = dir.register(watcher, new WatchEvent.Kind[]{StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_CREATE}, SensitivityWatchEventModifier.HIGH);
          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);
      }
docs: Register the given directory with the WatchService