public Result accessDiskWithCheckCanceled(@NotNull Param arg) {
    if (!isInCancellableContext()) {
      return myFunction.apply(arg);
    }
    Future<Result> future = myTasks.computeIfAbsent(arg, eachArg -> ProcessIOExecutorService.INSTANCE.submit(() -> {
      try {
        return myFunction.apply(eachArg);
      }
      finally {
        myTasks.remove(eachArg);
      }
    }));
    if (future.isDone()) {
      // maybe it was very fast and completed before being put into a map
      myTasks.remove(arg, future);
    }
    return ProgressIndicatorUtils.awaitWithCheckCanceled(future);
  }
public Result accessDiskWithCheckCanceled(@NotNull Param arg)