io.vertx.core

## Interface CompositeFuture

- All Superinterfaces:
    AsyncResult<CompositeFuture>, Future<CompositeFuture>

      public interface CompositeFuture
      extends Future<CompositeFuture>

  The composite future wraps a list of `futures`, it is useful when several futures needs to be coordinated. The handlers set for the coordinated futures are overridden by the handler of the composite future.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T1,T2> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2)` Deprecated. instead use `Future.all(Future, Future)`
    `static <T1,T2,T3> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3)` Deprecated. instead use `Future.all(Future, Future, Future)`
    `static <T1,T2,T3,T4> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)` Deprecated. instead use `Future.all(Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)` Deprecated. instead use `Future.all(Future, Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5,T6> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)` Deprecated. instead use `Future.all(Future, Future, Future, Future, Future, Future)`
    `static CompositeFuture` | `all(List<Future> futures)` Deprecated. instead use `Future.all(List)`
    `static <T1,T2> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2)` Deprecated. instead use `Future.any(Future, Future)`
    `static <T1,T2,T3> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3)` Deprecated. instead use `Future.any(Future, Future, Future)`
    `static <T1,T2,T3,T4> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)` Deprecated. instead use `Future.any(Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)` Deprecated. instead use `Future.any(Future, Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5,T6> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)` Deprecated. instead use `Future.any(Future, Future, Future, Future, Future, Future)`
    `static CompositeFuture` | `any(List<Future> futures)` Deprecated. instead use `Future.any(List)`
    `Throwable` | `cause(int index)` Returns a cause of a wrapped future
    `default List<Throwable>` | `causes()`
    `boolean` | `failed(int index)` Returns true if a wrapped future is failed
    `boolean` | `isComplete(int index)` Returns true if a wrapped future is completed
    `static <T1,T2> CompositeFuture` | `join(Future<T1> f1, Future<T2> f2)` Deprecated. instead use `Future.join(Future, Future)`
    `static <T1,T2,T3> CompositeFuture` | `join(Future<T1> f1, Future<T2> f2, Future<T3> f3)` Deprecated. instead use `Future.join(Future, Future, Future)`
    `static <T1,T2,T3,T4> CompositeFuture` | `join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)` Deprecated. instead use `Future.join(Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5> CompositeFuture` | `join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)` Deprecated. instead use `Future.join(Future, Future, Future, Future, Future)`
    `static <T1,T2,T3,T4,T5,T6> CompositeFuture` | `join(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5, Future<T6> f6)` Deprecated. instead use `Future.join(Future, Future, Future, Future, Future, Future)`
    `static CompositeFuture` | `join(List<Future> futures)` Deprecated. instead use `Future.join(List)`
    `default <T> List<T>` | `list()`
    `CompositeFuture` | `onComplete(Handler<AsyncResult<CompositeFuture>> handler)` Add a handler to be notified of the result.
    `default CompositeFuture` | `onFailure(Handler<Throwable> handler)` Add a handler to be notified of the failed result.
    `default CompositeFuture` | `onSuccess(Handler<CompositeFuture> handler)` Add a handler to be notified of the succeeded result.
    `<T> T` | `resultAt(int index)` Returns the result of a wrapped future
    `int` | `size()`
    `boolean` | `succeeded(int index)` Returns true if a wrapped future is succeeded

    - ### Methods inherited from interface io.vertx.core.Future

      `all, all, all, all, all, all, andThen, any, any, any, any, any, any, await, await, cause, compose, compose, eventually, eventually, expecting, failed, failedFuture, failedFuture, flatMap, fromCompletionStage, fromCompletionStage, future, isComplete, join, join, join, join, join, join, map, map, mapEmpty, onComplete, otherwise, otherwise, otherwiseEmpty, recover, result, succeeded, succeededFuture, succeededFuture, timeout, toCompletionStage, transform`

- - ### Method Detail

    - #### all

          @Deprecated
          static <T1,T2> CompositeFuture all(Future<T1> f1,
                                                         Future<T2> f2)

      Deprecated. instead use `Future.all(Future, Future)`
      Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.

      The returned future fails as soon as one of `f1` or `f2` fails.
      Parameters:
        `f1` - future
        `f2` - future
      Returns:
        the composite future

    - #### all

          @Deprecated
          static <T1,T2,T3> CompositeFuture all(Future<T1> f1,
                                                            Future<T2> f2,
                                                            Future<T3> f3)

      Deprecated. instead use `Future.all(Future, Future, Future)`
      Like `all(Future, Future)` but with 3 futures.

    - #### all

          @Deprecated
          static <T1,T2,T3,T4> CompositeFuture all(Future<T1> f1,
                                                               Future<T2> f2,
                                                               Future<T3> f3,
                                                               Future<T4> f4)

      Deprecated. instead use `Future.all(Future, Future, Future, Future)`
      Like `all(Future, Future)` but with 4 futures.

    - #### all

          @Deprecated
          static <T1,T2,T3,T4,T5> CompositeFuture all(Future<T1> f1,
                                                                  Future<T2> f2,
                                                                  Future<T3> f3,
                                                                  Future<T4> f4,
                                                                  Future<T5> f5)

      Deprecated. instead use `Future.all(Future, Future, Future, Future, Future)`
      Like `all(Future, Future)` but with 5 futures.

    - #### all

          @Deprecated
          static <T1,T2,T3,T4,T5,T6> CompositeFuture all(Future<T1> f1,
                                                                     Future<T2> f2,
                                                                     Future<T3> f3,
                                                                     Future<T4> f4,
                                                                     Future<T5> f5,
                                                                     Future<T6> f6)

      Deprecated. instead use `Future.all(Future, Future, Future, Future, Future, Future)`
      Like `all(Future, Future)` but with 6 futures.

    - #### all

          @Deprecated
          static CompositeFuture all(List<Future> futures)

      Deprecated. instead use `Future.all(List)`
      Like `all(Future, Future)` but with a list of futures.

      When the list is empty, the returned future will be already completed.

    - #### any

          @Deprecated
          static <T1,T2> CompositeFuture any(Future<T1> f1,
                                                         Future<T2> f2)

      Deprecated. instead use `Future.any(Future, Future)`
      Return a composite future, succeeded when any futures is succeeded, failed when all futures are failed.

      The returned future succeeds as soon as one of `f1` or `f2` succeeds.
      Parameters:
        `f1` - future
        `f2` - future
      Returns:
        the composite future

    - #### any

          @Deprecated
          static <T1,T2,T3> CompositeFuture any(Future<T1> f1,
                                                            Future<T2> f2,
                                                            Future<T3> f3)

      Deprecated. instead use `Future.any(Future, Future, Future)`
      Like `any(Future, Future)` but with 3 futures.

    - #### any

          @Deprecated
          static <T1,T2,T3,T4> CompositeFuture any(Future<T1> f1,
                                                               Future<T2> f2,
                                                               Future<T3> f3,
                                                               Future<T4> f4)

      Deprecated. instead use `Future.any(Future, Future, Future, Future)`
      Like `any(Future, Future)` but with 4 futures.

    - #### any

          @Deprecated
          static <T1,T2,T3,T4,T5> CompositeFuture any(Future<T1> f1,
                                                                  Future<T2> f2,
                                                                  Future<T3> f3,
                                                                  Future<T4> f4,
                                                                  Future<T5> f5)

      Deprecated. instead use `Future.any(Future, Future, Future, Future, Future)`
      Like `any(Future, Future)` but with 5 futures.

    - #### any

          @Deprecated
          static <T1,T2,T3,T4,T5,T6> CompositeFuture any(Future<T1> f1,
                                                                     Future<T2> f2,
                                                                     Future<T3> f3,
                                                                     Future<T4> f4,
                                                                     Future<T5> f5,
                                                                     Future<T6> f6)

      Deprecated. instead use `Future.any(Future, Future, Future, Future, Future, Future)`
      Like `any(Future, Future)` but with 6 futures.

    - #### any

          @Deprecated
          static CompositeFuture any(List<Future> futures)

      Deprecated. instead use `Future.any(List)`
      Like `any(Future, Future)` but with a list of futures.

      When the list is empty, the returned future will be already completed.

    - #### join

          @Deprecated
          static <T1,T2> CompositeFuture join(Future<T1> f1,
                                                          Future<T2> f2)

      Deprecated. instead use `Future.join(Future, Future)`
      Return a composite future, succeeded when all futures are succeeded, failed when any future is failed.

      It always wait until all its futures are completed and will not fail as soon as one of `f1` or `f2` fails.
      Parameters:
        `f1` - future
        `f2` - future
      Returns:
        the composite future

    - #### join

          @Deprecated
          static <T1,T2,T3> CompositeFuture join(Future<T1> f1,
                                                             Future<T2> f2,
                                                             Future<T3> f3)

      Deprecated. instead use `Future.join(Future, Future, Future)`
      Like `join(Future, Future)` but with 3 futures.

    - #### join

          @Deprecated
          static <T1,T2,T3,T4> CompositeFuture join(Future<T1> f1,
                                                                Future<T2> f2,
                                                                Future<T3> f3,
                                                                Future<T4> f4)

      Deprecated. instead use `Future.join(Future, Future, Future, Future)`
      Like `join(Future, Future)` but with 4 futures.

    - #### join

          @Deprecated
          static <T1,T2,T3,T4,T5> CompositeFuture join(Future<T1> f1,
                                                                   Future<T2> f2,
                                                                   Future<T3> f3,
                                                                   Future<T4> f4,
                                                                   Future<T5> f5)

      Deprecated. instead use `Future.join(Future, Future, Future, Future, Future)`
      Like `join(Future, Future)` but with 5 futures.

    - #### join

          @Deprecated
          static <T1,T2,T3,T4,T5,T6> CompositeFuture join(Future<T1> f1,
                                                                      Future<T2> f2,
                                                                      Future<T3> f3,
                                                                      Future<T4> f4,
                                                                      Future<T5> f5,
                                                                      Future<T6> f6)

      Deprecated. instead use `Future.join(Future, Future, Future, Future, Future, Future)`
      Like `join(Future, Future)` but with 6 futures.

    - #### join

          @Deprecated
          static CompositeFuture join(List<Future> futures)

      Deprecated. instead use `Future.join(List)`
      Like `join(Future, Future)` but with a list of futures.

      When the list is empty, the returned future will be already completed.

    - #### onComplete

          CompositeFuture onComplete(Handler<AsyncResult<CompositeFuture>> handler)

      Description copied from interface: `Future`
      Add a handler to be notified of the result.

      WARNING: this is a terminal operation. If several `handler`s are registered, there is no guarantee that they will be invoked in order of registration.

      Specified by:
        `onComplete` in interface `Future<CompositeFuture>`
      Parameters:
        `handler` - the handler that will be called with the result
      Returns:
        a reference to this, so it can be used fluently

    - #### onSuccess

          default CompositeFuture onSuccess(Handler<CompositeFuture> handler)

      Description copied from interface: `Future`
      Add a handler to be notified of the succeeded result.

      WARNING: this is a terminal operation. If several `handler`s are registered, there is no guarantee that they will be invoked in order of registration.

      Specified by:
        `onSuccess` in interface `Future<CompositeFuture>`
      Parameters:
        `handler` - the handler that will be called with the succeeded result
      Returns:
        a reference to this, so it can be used fluently

    - #### onFailure

          default CompositeFuture onFailure(Handler<Throwable> handler)

      Description copied from interface: `Future`
      Add a handler to be notified of the failed result.

      WARNING: this is a terminal operation. If several `handler`s are registered, there is no guarantee that they will be invoked in order of registration.

      Specified by:
        `onFailure` in interface `Future<CompositeFuture>`
      Parameters:
        `handler` - the handler that will be called with the failed result
      Returns:
        a reference to this, so it can be used fluently

    - #### cause

          Throwable cause(int index)

      Returns a cause of a wrapped future
      Parameters:
        `index` - the wrapped future index

    - #### succeeded

          boolean succeeded(int index)

      Returns true if a wrapped future is succeeded
      Parameters:
        `index` - the wrapped future index

    - #### failed

          boolean failed(int index)

      Returns true if a wrapped future is failed
      Parameters:
        `index` - the wrapped future index

    - #### isComplete

          boolean isComplete(int index)

      Returns true if a wrapped future is completed
      Parameters:
        `index` - the wrapped future index

    - #### resultAt

          <T> T resultAt(int index)

      Returns the result of a wrapped future
      Parameters:
        `index` - the wrapped future index

    - #### size

          int size()

      Returns:
        the number of wrapped future

    - #### list

          default <T> List<T> list()

      Returns:
        a list of the current completed values. If one future is not yet resolved or is failed, null will be used

    - #### causes

          default List<Throwable> causes()

      Returns:
        a list of all the eventual failure causes. If no future failed, returns a list of null values.

Copyright © 2025 Eclipse. All rights reserved.