code: public void cancelKeyAndDiscardResources(final EventDispatcher pDispatcher) {
          try {
              getWatchKey().cancel();
          } finally {
              resources.keySet().removeIf(p -> {
                  informDiscard(pDispatcher, p);
                  return true;
              });
          }
      }
docs: Cancels the {@link WatchKey} held by this directory object (see {@link WatchKey#cancel()}).
  After this, checksum resources are cleared and no more events for this directory can be retrieved.