Class Async
java.lang.Object
graphql.execution.Async
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate static classprivate static classprivate static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U> CompletableFuture <List<U>> each(Collection<T> list, Function<T, CompletableFuture<U>> cfFactory) static <T,U> CompletableFuture <List<U>> eachSequentially(Iterable<T> list, BiFunction<T, List<U>, CompletableFuture<U>> cfFactory) private static <T,U> void eachSequentiallyImpl(Iterator<T> iterator, BiFunction<T, List<U>, CompletableFuture<U>> cfFactory, List<U> tmpResult, CompletableFuture<List<U>> overallResult) static <T> CompletableFuture<T> exceptionallyCompletedFuture(Throwable exception) static <T> Async.CombinedBuilder<T> ofExpectedSize(int expectedSize) Combines 0 or more CF into one.static <T> @NotNull CompletableFuture<T> orNullCompletedFuture(@Nullable CompletableFuture<T> completableFuture) If the passed in CompletableFuture is null then it creates a CompletableFuture that resolves to nullstatic <T> CompletableFuture<T> toCompletableFuture(T t) Turns an object T into a CompletableFuture if it's not alreadystatic <T> CompletableFuture<T> tryCatch(Supplier<CompletableFuture<T>> supplier)
-
Constructor Details
-
Async
public Async()
-
-
Method Details
-
ofExpectedSize
Combines 0 or more CF into one. It is a wrapper aroundCompletableFuture.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
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
-
exceptionallyCompletedFuture
-
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
-