Class CompletableFutures

java.lang.Object
com.ironcorelabs.tenantsecurity.utils.CompletableFutures

public final class CompletableFutures extends Object
Utility functions for working with CompletableFutures.
  • Constructor Details

    • CompletableFutures

      public CompletableFutures()
  • Method Details

    • sequence

      public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures)
      Convert a List of CompletableFutures into a CompletableFuture of a List.
    • tryCatchNonFatal

      public static <T> CompletableFuture<T> tryCatchNonFatal(CompletableFutureSupplier<T> function)
      Try to run the given function, placing the value in a CompletableFuture. Exceptions will be caught in a failed CompletableFuture, fatal Throwables should still bubble up.
      Parameters:
      function - function (that may throw) to run and capture the value of.
      Returns:
      CompleteableFuture either completed with the resulting value or failed with an exception.