public class PgxFuture<T>
extends java.util.concurrent.CompletableFuture<T>
CompletableFuture
Constructor and Description |
---|
PgxFuture() |
Modifier and Type | Method and Description |
---|---|
static <T> PgxFuture<java.lang.Void> |
allOf(java.util.List<PgxFuture<T>> promises) |
boolean |
cancel() |
PgxFuture<T> |
cancelOn(PgxFuture promise)
If given promise completes exceptionally because it was canceled,
cancel() gets called on this
promise as well. |
static <T> PgxFuture<T> |
completedFuture(T arg) |
PgxFuture<T> |
exceptionally(java.util.function.Function<java.lang.Throwable,? extends T> fn) |
static <T> PgxFuture<T> |
exceptionallyCompletedFuture(java.lang.Throwable throwable) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
T |
getNow(T valueIfAbsent) |
<U> PgxFuture<U> |
handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn) |
boolean |
isConsumed() |
T |
join() |
PgxFuture<java.lang.Void> |
thenAccept(java.util.function.Consumer<? super T> block) |
<U> PgxFuture<U> |
thenApply(java.util.function.Function<? super T,? extends U> function) |
<U> PgxFuture<U> |
thenApplyAsync(java.util.function.Function<? super T,? extends U> function,
java.util.concurrent.Executor executor) |
<U,V> PgxFuture<V> |
thenCombine(java.util.concurrent.CompletableFuture<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends V> function) |
PgxFuture<T> |
thenComplete(PgxFuture<T> promise)
completes the given promise whenever this completes.
|
PgxFuture<T> |
thenComplete(PgxFuture<T> promise,
java.lang.Runnable cleanup)
completes the given promise whenever this completes.
|
<U> PgxFuture<U> |
thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> function) |
<U> PgxFuture<U> |
thenReturn(U result)
A future that discards its result and returns the given parameter
on completion.
|
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeExceptionally, getNumberOfDependents, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, obtrudeException, obtrudeValue, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
public boolean cancel()
public PgxFuture<T> cancelOn(PgxFuture promise)
cancel()
gets called on this
promise as well.promise
- If given promise completes exceptionally because it was canceled, cancel()
gets called on
this promise as well. If given promise completes exceptionally (regardless of the causing
exception) and
this promise has started or is done, this promise is then rolled back.public static <T> PgxFuture<T> completedFuture(T arg)
public PgxFuture<T> exceptionally(java.util.function.Function<java.lang.Throwable,? extends T> fn)
public static <T> PgxFuture<T> exceptionallyCompletedFuture(java.lang.Throwable throwable)
public T get() throws 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
public T getNow(T valueIfAbsent)
getNow
in class java.util.concurrent.CompletableFuture<T>
public <U> PgxFuture<U> handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
public boolean isConsumed()
public PgxFuture<java.lang.Void> thenAccept(java.util.function.Consumer<? super T> block)
public <U> PgxFuture<U> thenApply(java.util.function.Function<? super T,? extends U> function)
public <U> PgxFuture<U> thenApplyAsync(java.util.function.Function<? super T,? extends U> function, java.util.concurrent.Executor executor)
public <U,V> PgxFuture<V> thenCombine(java.util.concurrent.CompletableFuture<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> function)
public PgxFuture<T> thenComplete(PgxFuture<T> promise)
If this completes exceptionally, the given promise is completed exceptionally as well.
promise
- the promisepublic PgxFuture<T> thenComplete(PgxFuture<T> promise, java.lang.Runnable cleanup)
If this completes exceptionally, the given promise is completed exceptionally as well.
promise
- cleanup
- to be run upon completion (can be null)public <U> PgxFuture<U> thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> function)
public <U> PgxFuture<U> thenReturn(U result)
Shortcut for thenApply(t -> result)
.
result
- the result to return on completion of this futureCopyright © 2015 - 2020 Oracle and/or its affiliates. All Rights Reserved.