T
- The completion type for this Futurejava.util.concurrent.CompletionStage<T>
, java.util.concurrent.Future<T>
Promise
, RestFuture
public interface RequestFuture<T>
extends java.util.concurrent.Future<T>, java.util.concurrent.CompletionStage<T>
Modifier and Type | Method | Description |
---|---|---|
static <F extends java.util.concurrent.Future<?> & java.util.concurrent.CompletionStage<?>> |
allOf(java.util.Collection<F> cfs) |
Returns a new CompletableFuture that is completed when all of
the given Futures complete.
|
static java.util.concurrent.CompletableFuture<java.lang.Void> |
allOf(RequestFuture<?>... cfs) |
Returns a new CompletableFuture that is completed when all of
the given RequestFutures complete.
|
static <F extends java.util.concurrent.Future<?> & java.util.concurrent.CompletionStage<?>> |
anyOf(java.util.Collection<F> cfs) |
Returns a new CompletableFuture that is completed when any of
the given Futures complete, with the same result.
|
static java.util.concurrent.CompletableFuture<java.lang.Object> |
anyOf(RequestFuture<?>... cfs) |
Returns a new CompletableFuture that is completed when any of
the given RequestFutures complete, with the same result.
|
T |
getNow(T valueIfAbsent) |
Returns the result value (or throws any encountered exception)
if completed, else returns the given valueIfAbsent.
|
int |
getNumberOfDependents() |
Returns the estimated number of RequestFutures whose
completions are awaiting completion of this RequestFuture.
|
boolean |
isCompletedExceptionally() |
Returns
true if this RequestFuture completed
exceptionally, in any way. |
T |
join() |
Returns the result value when complete, or throws an
(unchecked) exception if completed exceptionally.
|
java.util.concurrent.CompletableFuture<T> |
toCompletableFuture() |
This method is unsupported by the current implementation!
|
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, whenComplete, whenCompleteAsync, whenCompleteAsync
static java.util.concurrent.CompletableFuture<java.lang.Void> allOf(RequestFuture<?>... cfs)
null
.
Among the applications of this method is to await completion
of a set of independent RequestFutures before continuing a
program, as in: RequestFuture.allOf(c1, c2,
c3).join();
.
cfs
- the RequestFuturesjava.lang.IllegalArgumentException
- if the array or any of its elements are null
CompletableFuture.allOf(...)
static <F extends java.util.concurrent.Future<?> & java.util.concurrent.CompletionStage<?>> java.util.concurrent.CompletableFuture<java.lang.Void> allOf(java.util.Collection<F> cfs)
null
.
Among the applications of this method is to await completion
of a set of independent RequestFutures before continuing a
program, as in: RequestFuture.allOf(c1, c2,
c3).join();
.
F
- the future implementationcfs
- the Futuresjava.lang.IllegalArgumentException
- if the collection or any of its elements are null
CompletableFuture.allOf(...)
static java.util.concurrent.CompletableFuture<java.lang.Object> anyOf(RequestFuture<?>... cfs)
cfs
- the RequestFuturesjava.lang.IllegalArgumentException
- if the array or any of its elements are null
CompletableFuture.anyOf(...)
static <F extends java.util.concurrent.Future<?> & java.util.concurrent.CompletionStage<?>> java.util.concurrent.CompletableFuture<java.lang.Object> anyOf(java.util.Collection<F> cfs)
F
- the future implementationcfs
- the Futuresjava.lang.IllegalArgumentException
- if the collection or any of its elements are null
CompletableFuture.anyOf(...)
T join()
CompletionException
with the underlying
exception as its cause.java.util.concurrent.CancellationException
- if the computation was cancelledjava.util.concurrent.CompletionException
- if this future completed exceptionally
or a completion computation threw an exceptionT getNow(T valueIfAbsent)
valueIfAbsent
- the value to return if not completedjava.util.concurrent.CancellationException
- if the computation was cancelledjava.util.concurrent.CompletionException
- if this future completed exceptionally
or a completion computation threw an exceptionboolean isCompletedExceptionally()
true
if this RequestFuture completed
exceptionally, in any way. Possible causes include
cancellation, explicit invocation of
completeExceptionally
, and abrupt termination of a
CompletionStage action.true
if this RequestFuture completed exceptionallyint getNumberOfDependents()