Class Async

java.lang.Object
graphql.execution.Async

public class Async extends Object
  • Constructor Details

    • Async

      public Async()
  • Method Details

    • ofExpectedSize

      public static <T> Async.CombinedBuilder<T> ofExpectedSize(int expectedSize)
      Combines 0 or more CF into one. It is a wrapper around CompletableFuture.allOf.
      Type Parameters:
      T - for two
      Parameters:
      expectedSize - how many we expect
      Returns:
      a combined builder of CFs
    • each

      public static <T, U> CompletableFuture<List<U>> each(Collection<T> list, Function<T,CompletableFuture<U>> cfFactory)
    • eachSequentially

      public static <T, U> CompletableFuture<List<U>> eachSequentially(Iterable<T> list, BiFunction<T,List<U>,CompletableFuture<U>> cfFactory)
    • eachSequentiallyImpl

      private static <T, U> void eachSequentiallyImpl(Iterator<T> iterator, BiFunction<T,List<U>,CompletableFuture<U>> cfFactory, List<U> tmpResult, CompletableFuture<List<U>> overallResult)
    • toCompletableFuture

      public static <T> CompletableFuture<T> toCompletableFuture(T t)
      Turns an object T into a CompletableFuture if it's not already
      Type Parameters:
      T - for two
      Parameters:
      t - - the object to check
      Returns:
      a CompletableFuture
    • tryCatch

      public static <T> CompletableFuture<T> tryCatch(Supplier<CompletableFuture<T>> supplier)
    • exceptionallyCompletedFuture

      public static <T> CompletableFuture<T> exceptionallyCompletedFuture(Throwable exception)
    • orNullCompletedFuture

      @NotNull public static <T> @NotNull CompletableFuture<T> orNullCompletedFuture(@Nullable @Nullable CompletableFuture<T> completableFuture)
      If the passed in CompletableFuture is null then it creates a CompletableFuture that resolves to null
      Type Parameters:
      T - for two
      Parameters:
      completableFuture - the CF to use
      Returns:
      the completableFuture if it's not null or one that always resoles to null