code: void handleCreateEvent(WatchKey key, Path path) {
      if (!isTrackingKey(key)) {
        return;
      }
  
      path = actualPath(key, path);
  
      // if a new dir is created we need to register it to our watcher
      // else inner events won't be tracked. In some cases, we may only
      // receive an event for the top level dir: any further nested dir
      // will not have any event as we haven't registered them. We'll
      // need to manually traverse and make sure we got them too.
      if (Files.isDirectory(path)) {
        FileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {
          @Override
          public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
            register(dir, watcher);
  
            entryCreated(dir);
            return FileVisitResult.CONTINUE;
          }
  
          @Override
          public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
            entryCreated(file);
  
            return FileVisitResult.CONTINUE;
          }
        };
  
        try {
          Files.walkFileTree(path, visitor);
        } catch (IOException e) {
        }
      }
    }
docs: /* Handlers