Class CompletableFutures
java.lang.Object
com.ironcorelabs.tenantsecurity.utils.CompletableFutures
Utility functions for working with CompletableFutures.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CompletableFuture<List<T>>
sequence
(List<CompletableFuture<T>> futures) Convert a List of CompletableFutures into a CompletableFuture of a List.static <T> CompletableFuture<T>
tryCatchNonFatal
(CompletableFutureSupplier<T> function) Try to run the given function, placing the value in a CompletableFuture.
-
Constructor Details
-
CompletableFutures
public CompletableFutures()
-
-
Method Details
-
sequence
Convert a List of CompletableFutures into a CompletableFuture of a List. -
tryCatchNonFatal
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.
-