public static <T, E extends Throwable> T computeWithLockAndCheckingCanceled(@NotNull Lock lock,
                                                                              int timeout,
                                                                              @NotNull TimeUnit timeUnit,
                                                                              @NotNull ThrowableComputable<T, E> computable) throws E, ProcessCanceledException {
    awaitWithCheckCanceled(() -> lock.tryLock(timeout, timeUnit));
    try {
      return computable.compute();
    }
    finally {
      lock.unlock();
    }
  }
public static <T, E extends Throwable> T computeWithLockAndCheckingCanceled(@NotNull Lock lock,
                                                                              int timeout,
                                                                              @NotNull TimeUnit timeUnit,
                                                                              @NotNull ThrowableComputable<T, E> computable)