public class CompletableFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>
Modifier and Type | Method and Description |
---|---|
<U> CompletableFuture<U> |
callAfterBoth(CompletableFuture<?> other,
Try.Callable<U,java.lang.RuntimeException> action) |
<U,R> CompletableFuture<R> |
callAfterBoth(CompletableFuture<U> other,
BiFunction<T,U,R> action) |
<U,R> CompletableFuture<R> |
callAfterBoth(CompletableFuture<U> other,
Function<Tuple.Tuple4<T,java.lang.Throwable,U,java.lang.Throwable>,R> action) |
<U> CompletableFuture<U> |
callAfterEither(CompletableFuture<?> other,
Try.Callable<U,java.lang.RuntimeException> action) |
<R> CompletableFuture<R> |
callAfterEither(CompletableFuture<? extends T> other,
BiFunction<? super T,java.lang.Throwable,R> action) |
<R> CompletableFuture<R> |
callAfterEither(CompletableFuture<? extends T> other,
Function<? super T,R> action) |
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
cancelAll(boolean mayInterruptIfRunning)
Cancel this future and all the previous stage future recursively.
|
static <T> CompletableFuture<T> |
completed(T result) |
CompletableFuture<T> |
delayed(long delay,
java.util.concurrent.TimeUnit unit) |
T |
get() |
<U> U |
get(BiFunction<? super T,java.lang.Throwable,? extends U> action) |
<U> U |
get(Function<? super T,? extends U> action) |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
<U> U |
get(long timeout,
java.util.concurrent.TimeUnit unit,
BiFunction<? super T,java.lang.Throwable,? extends U> action) |
<U> U |
get(long timeout,
java.util.concurrent.TimeUnit unit,
Function<? super T,? extends U> action) |
Pair<T,java.lang.Throwable> |
get2() |
Pair<T,java.lang.Throwable> |
get2(long timeout,
java.util.concurrent.TimeUnit unit) |
T |
getNow(T defaultValue) |
boolean |
isAllCancelled()
Returns true if this future and all previous stage futures have been recursively cancelled, otherwise false is returned.
|
boolean |
isCancelled() |
boolean |
isDone() |
static CompletableFuture<java.lang.Void> |
run(java.lang.Runnable action) |
static CompletableFuture<java.lang.Void> |
run(java.lang.Runnable action,
java.util.concurrent.Executor executor) |
static <T> CompletableFuture<T> |
run(Try.Callable<T,java.lang.RuntimeException> action) |
static <T> CompletableFuture<T> |
run(Try.Callable<T,java.lang.RuntimeException> action,
java.util.concurrent.Executor executor) |
CompletableFuture<java.lang.Void> |
runAfterBoth(CompletableFuture<?> other,
java.lang.Runnable action) |
<U> CompletableFuture<java.lang.Void> |
runAfterBoth(CompletableFuture<U> other,
BiConsumer<T,U> action) |
<U> CompletableFuture<java.lang.Void> |
runAfterBoth(CompletableFuture<U> other,
Consumer<Tuple.Tuple4<T,java.lang.Throwable,U,java.lang.Throwable>> action) |
CompletableFuture<java.lang.Void> |
runAfterEither(CompletableFuture<?> other,
java.lang.Runnable action) |
CompletableFuture<java.lang.Void> |
runAfterEither(CompletableFuture<? extends T> other,
BiConsumer<? super T,java.lang.Throwable> action) |
CompletableFuture<java.lang.Void> |
runAfterEither(CompletableFuture<? extends T> other,
Consumer<? super T> action) |
<R> CompletableFuture<R> |
thenCall(BiFunction<? super T,java.lang.Throwable,R> action) |
<R> CompletableFuture<R> |
thenCall(Function<? super T,R> action) |
<U> CompletableFuture<U> |
thenCall(Try.Callable<U,java.lang.RuntimeException> action) |
CompletableFuture<java.lang.Void> |
thenRun(BiConsumer<? super T,java.lang.Throwable> action) |
CompletableFuture<java.lang.Void> |
thenRun(Consumer<? super T> action) |
CompletableFuture<java.lang.Void> |
thenRun(java.lang.Runnable action) |
CompletableFuture<T> |
with(java.util.concurrent.Executor executor) |
CompletableFuture<T> |
with(java.util.concurrent.Executor executor,
long delay,
java.util.concurrent.TimeUnit unit) |
public static CompletableFuture<java.lang.Void> run(java.lang.Runnable action)
public static <T> CompletableFuture<T> run(Try.Callable<T,java.lang.RuntimeException> action)
public static CompletableFuture<java.lang.Void> run(java.lang.Runnable action, java.util.concurrent.Executor executor)
public static <T> CompletableFuture<T> run(Try.Callable<T,java.lang.RuntimeException> action, java.util.concurrent.Executor executor)
public static <T> CompletableFuture<T> completed(T result)
result
- asyncExecutor
- public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean cancelAll(boolean mayInterruptIfRunning)
mayInterruptIfRunning
- public boolean isAllCancelled()
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public <U> U get(long timeout, java.util.concurrent.TimeUnit unit, Function<? super T,? extends U> action)
public <U> U get(BiFunction<? super T,java.lang.Throwable,? extends U> action)
public <U> U get(long timeout, java.util.concurrent.TimeUnit unit, BiFunction<? super T,java.lang.Throwable,? extends U> action)
public CompletableFuture<java.lang.Void> thenRun(java.lang.Runnable action)
public CompletableFuture<java.lang.Void> thenRun(Consumer<? super T> action)
public CompletableFuture<java.lang.Void> thenRun(BiConsumer<? super T,java.lang.Throwable> action)
public <U> CompletableFuture<U> thenCall(Try.Callable<U,java.lang.RuntimeException> action)
public <R> CompletableFuture<R> thenCall(Function<? super T,R> action)
public <R> CompletableFuture<R> thenCall(BiFunction<? super T,java.lang.Throwable,R> action)
public CompletableFuture<java.lang.Void> runAfterBoth(CompletableFuture<?> other, java.lang.Runnable action)
public <U> CompletableFuture<java.lang.Void> runAfterBoth(CompletableFuture<U> other, BiConsumer<T,U> action)
public <U> CompletableFuture<java.lang.Void> runAfterBoth(CompletableFuture<U> other, Consumer<Tuple.Tuple4<T,java.lang.Throwable,U,java.lang.Throwable>> action)
public <U> CompletableFuture<U> callAfterBoth(CompletableFuture<?> other, Try.Callable<U,java.lang.RuntimeException> action)
public <U,R> CompletableFuture<R> callAfterBoth(CompletableFuture<U> other, BiFunction<T,U,R> action)
public <U,R> CompletableFuture<R> callAfterBoth(CompletableFuture<U> other, Function<Tuple.Tuple4<T,java.lang.Throwable,U,java.lang.Throwable>,R> action)
public CompletableFuture<java.lang.Void> runAfterEither(CompletableFuture<?> other, java.lang.Runnable action)
public CompletableFuture<java.lang.Void> runAfterEither(CompletableFuture<? extends T> other, Consumer<? super T> action)
public CompletableFuture<java.lang.Void> runAfterEither(CompletableFuture<? extends T> other, BiConsumer<? super T,java.lang.Throwable> action)
public <U> CompletableFuture<U> callAfterEither(CompletableFuture<?> other, Try.Callable<U,java.lang.RuntimeException> action)
public <R> CompletableFuture<R> callAfterEither(CompletableFuture<? extends T> other, Function<? super T,R> action)
public <R> CompletableFuture<R> callAfterEither(CompletableFuture<? extends T> other, BiFunction<? super T,java.lang.Throwable,R> action)
public CompletableFuture<T> delayed(long delay, java.util.concurrent.TimeUnit unit)
public CompletableFuture<T> with(java.util.concurrent.Executor executor)
public CompletableFuture<T> with(java.util.concurrent.Executor executor, long delay, java.util.concurrent.TimeUnit unit)