class SafeFuture extends CompletableFuture<T> {

  public static SafeFuture<Void> fromRunnable(final ExceptionThrowingRunnable action) {
    try {
      action.run();
      return SafeFuture.COMPLETE;
    } catch (Throwable t) {
      return SafeFuture.failedFuture(t);
    }
  }

}