Class CompletableFutureUtils

java.lang.Object
se.liu.ida.hefquin.base.utils.CompletableFutureUtils

public class CompletableFutureUtils extends Object
  • Constructor Details

    • CompletableFutureUtils

      public CompletableFutureUtils()
  • Method Details

    • getAll

      public static <T> T[] getAll(CompletableFuture<? extends T>[] futures, Class<T> clazz) throws CompletableFutureUtils.GetAllException
      Helper function that waits for all the given futures to complete and, then, returns their respective results. The returned array contains as many result objects as there are futures in the given list of futures, where the i-th result object in the returned array is the result of the i-th future in the given list. If any of the futures causes an exception, the function cancels all remaining futures and throws an exception that wraps the causing exception as its cause. The member CompletableFutureUtils.GetAllException.i in this exception indicates the index of the future that caused the exception.
      Throws:
      CompletableFutureUtils.GetAllException