code: public void stopWatching() {
      try {
        _watchService.close();
        _watchService = null;
        _watchedDirectories = null;
      } catch (IOException e) {
        throw new RuntimeException("Could not stop watching directories!", e);
      }
    }
docs: Close the watch service. Releases resources. After calling, this instance becomes invalid and can't be used any more.