private @NotNull <T> CancellablePromise<T> promise(@NotNull Task<T, ?> task) {
    if (!isValidThread()) {
      return promise(task, 0);
    }
    count.incrementAndGet();
    invokeSafely(task, 0);
    return task.promise;
  }
private @NotNull <T> CancellablePromise<T> promise(@NotNull Task<T, ?> task)