Example usage for Java java.util.concurrent CompletableFuture fields, constructors, methods, implement or subclass
The text is from its open source code.
CompletableFuture() Creates a new incomplete CompletableFuture. |
CompletableFuture | allOf(CompletableFuture>... cfs) Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete. |
CompletableFuture | anyOf(CompletableFuture>... cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result. |
boolean | cancel(boolean mayInterruptIfRunning) If not already completed, completes this CompletableFuture with a CancellationException . |
boolean | complete(T value) If not already completed, sets the value returned by #get() and related methods to the given value. |
CompletableFuture | completedFuture(U value) Returns a new CompletableFuture that is already completed with the given value. |
boolean | completeExceptionally(Throwable ex) If not already completed, causes invocations of #get() and related methods to throw the given exception. |
CompletableFuture | exceptionally(Function |
T | get() Waits if necessary for this future to complete, and then returns its result. |
T | get(long timeout, TimeUnit unit) Waits if necessary for at most the given time for this future to complete, and then returns its result, if available. |
T | getNow(T valueIfAbsent) Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent. |
CompletableFuture | handle(BiFunction super T, Throwable, ? extends U> fn) |
CompletableFuture | handleAsync(BiFunction super T, Throwable, ? extends U> fn) |
int | hashCode() Returns a hash code value for the object. |
boolean | isCancelled() Returns true if this CompletableFuture was cancelled before it completed normally. |
boolean | isCompletedExceptionally() Returns true if this CompletableFuture completed exceptionally, in any way. |
boolean | isDone() Returns true if completed in any fashion: normally, exceptionally, or via cancellation. |
T | join() Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally. |
void | obtrudeException(Throwable ex) Forcibly causes subsequent invocations of method #get() and related methods to throw the given exception, whether or not already completed. |
CompletableFuture | runAsync(Runnable runnable, Executor executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action. |
CompletableFuture | runAsync(Runnable runnable) Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool#commonPool() after it runs the given action. |
CompletableFuture | supplyAsync(Supplier supplier, Executor executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier. |
CompletableFuture | supplyAsync(Supplier supplier) Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool#commonPool() with the value obtained by calling the given Supplier. |
CompletableFuture | thenAccept(Consumer super T> action) |
CompletableFuture | thenAcceptAsync(Consumer super T> action) |
CompletableFuture | thenAcceptAsync(Consumer super T> action, Executor executor) |
CompletableFuture | thenApply(Function super T, ? extends U> fn) |
CompletableFuture | thenApplyAsync(Function super T, ? extends U> fn, Executor executor) |
CompletableFuture | thenApplyAsync(Function super T, ? extends U> fn) |
CompletableFuture | thenCombine(CompletionStage extends U> other, BiFunction super T, ? super U, ? extends V> fn) |
CompletableFuture | thenCompose(Function super T, ? extends CompletionStage> fn) |
CompletableFuture | thenComposeAsync(Function super T, ? extends CompletionStage> fn, Executor executor) |
CompletableFuture | thenComposeAsync(Function super T, ? extends CompletionStage> fn) |
CompletableFuture | thenRun(Runnable action) |
void | wait() Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
CompletableFuture | whenComplete(BiConsumer super T, ? super Throwable> action) |
CompletableFuture | whenCompleteAsync(BiConsumer super T, ? super Throwable> action, Executor executor) |