The composite future wraps a list of futures, it is useful when several futures needs to be coordinated.
| Constructor and description |
|---|
CompositeFuture
(java.lang.Object delegate) |
| Type | Name and description |
|---|---|
static CompositeFuture |
all(Future<T1> f1, Future<T2> f2)Return a composite future, succeeded when all futures are succeeded, failed when any future is failed. |
static CompositeFuture |
all(Future<T1> f1, Future<T2> f2, Future<T3> f3)Like CompositeFuture.all but with 3 futures. |
static CompositeFuture |
all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)Like CompositeFuture.all but with 4 futures. |
static CompositeFuture |
all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)Like CompositeFuture.all but with 5 futures. |
static CompositeFuture |
all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)Like CompositeFuture.all but with 6 futures. |
static CompositeFuture |
all(java.util.List<Future> futures)Like CompositeFuture.all but with a list of futures. |
static CompositeFuture |
any(Future<T1> f1, Future<T2> f2)Return a composite future, succeeded when any futures is succeeded, failed when all futures are failed. |
static CompositeFuture |
any(Future<T1> f1, Future<T2> f2, Future<T3> f3)Like CompositeFuture.any but with 3 futures. |
static CompositeFuture |
any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)Like CompositeFuture.any but with 4 futures. |
static CompositeFuture |
any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)Like CompositeFuture.any but with 5 futures. |
static CompositeFuture |
any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)Like CompositeFuture.any but with 6 futures. |
static CompositeFuture |
any(java.util.List<Future> futures)Like CompositeFuture.any but with a list of futures. |
java.lang.Throwable |
cause(int index)Returns a cause of a wrapped future |
void |
complete(CompositeFuture result)Set the result. |
io.vertx.core.Handler<io.vertx.core.AsyncResult<CompositeFuture>> |
completer()@return an handler completing this future |
Future<U> |
compose(io.vertx.core.Handler<CompositeFuture> handler, Future<U> next)Compose this future with a provided next future. |
Future<U> |
compose(java.util.function.Function<CompositeFuture, Future<U>> mapper)Compose this future with a mapper function. |
boolean |
failed(int index)Returns true if a wrapped future is failed |
java.lang.Object |
getDelegate() |
boolean |
isComplete(int index)Returns true if a wrapped future is completed |
static CompositeFuture |
join(Future<T1> f1, Future<T2> f2)Return a composite future completed when all the futures are completed. |
static CompositeFuture |
join(Future<T1> f1, Future<T2> f2, Future<T3> f3)Like CompositeFuture.join but with 3 futures. |
static CompositeFuture |
join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)Like CompositeFuture.join but with 4 futures. |
static CompositeFuture |
join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)Like CompositeFuture.join but with 5 futures. |
static CompositeFuture |
join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)Like CompositeFuture.join but with 6 futures. |
static CompositeFuture |
join(java.util.List<Future> futures)Like CompositeFuture.join but with a list of futures. |
Future<U> |
map(java.util.function.Function<CompositeFuture, U> mapper)Apply a mapper function on this future. |
CompositeFuture |
result()The result of the operation. |
T |
resultAt(int index)Returns the result of a wrapped future |
CompositeFuture |
setHandler(io.vertx.core.Handler<io.vertx.core.AsyncResult<CompositeFuture>> handler) |
int |
size()@return the number of wrapped future |
boolean |
succeeded(int index)Returns true if a wrapped future is succeeded |
| Methods inherited from class | Name |
|---|---|
class Future |
cause, complete, complete, completer, compose, compose, fail, fail, failed, failedFuture, future, getDelegate, isComplete, map, map, result, setHandler, succeeded, succeededFuture, succeededFuture |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.
The returned future fails as soon as one off1 or f2 fails.
f1 - futuref2 - futureLike CompositeFuture.all but with 3 futures.
Like CompositeFuture.all but with 4 futures.
Like CompositeFuture.all but with 5 futures.
Like CompositeFuture.all but with 6 futures.
Like CompositeFuture.all but with a list of futures.
When the list is empty, the returned future will be already completed.
Return a composite future, succeeded when any futures is succeeded, failed when all futures are failed.
The returned future succeeds as soon as one off1 or f2 succeeds.
f1 - futuref2 - futureLike CompositeFuture.any but with 3 futures.
Like CompositeFuture.any but with 4 futures.
Like CompositeFuture.any but with 5 futures.
Like CompositeFuture.any but with 6 futures.
Like CompositeFuture.any but with a list of futures.
When the list is empty, the returned future will be already completed.
Returns a cause of a wrapped future
index - the wrapped future indexSet the result. Any handler will be called, if there is one, and the future will be marked as completed.
result - the result
Compose this future with a provided next future.
When this (the one on which compose is called) future succeeds, the handler will be called with
the completed value, this handler should complete the next future.
If the handler throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the next future and the handler
will not be called.
handler - the handlernext - the next future Compose this future with a mapper function.
When this future (the one on which compose is called) succeeds, the mapper will be called with
the completed value and this mapper returns another future object. This returned future completion will complete
the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
mapper - the mapper functionReturns true if a wrapped future is failed
index - the wrapped future indexReturns true if a wrapped future is completed
index - the wrapped future indexReturn a composite future completed when all the futures are completed.
Succeeded when all futures are succeeded, failed when any future is failed.f1 - futuref2 - futureLike CompositeFuture.join but with 3 futures.
Like CompositeFuture.join but with 4 futures.
Like CompositeFuture.join but with 5 futures.
Like CompositeFuture.join but with 6 futures.
Like CompositeFuture.join but with a list of futures.
When the list is empty, the returned future will be already completed.
Apply a mapper function on this future.
When this future succeeds, the mapper will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
mapper - the mapper functionThe result of the operation. This will be null if the operation failed.
Returns the result of a wrapped future
index - the wrapped future index
Returns true if a wrapped future is succeeded
index - the wrapped future index