code: private void registerDirectory(Path path) {
          try {
              LOGGER.info("监控目录:" + path);
              WatchKey key = path.register(watchService, events);
              directories.put(key, path);
          } catch (IOException ex) {
              LOGGER.error("监控目录失败：" + path.toAbsolutePath(), ex);
          }
      }
docs: 为指定目录注册监控事件
  @param path