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.
  Author:
    Julien Viet

- - ### Field Summary

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

      `factory`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T1,T2> 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 <T1,T2,T3> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3)` Like `all(Future, Future)` but with 3 futures.
    `static <T1,T2,T3,T4> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)` Like `all(Future, Future)` but with 4 futures.
    `static <T1,T2,T3,T4,T5> CompositeFuture` | `all(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)` Like `all(Future, Future)` but with 5 futures.
    `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)` Like `all(Future, Future)` but with 6 futures.
    `static CompositeFuture` | `all(List<Future> futures)` Like `all(Future, Future)` but with a list of futures.
    `static <T1,T2> 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 <T1,T2,T3> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3)` Like `any(Future, Future)` but with 3 futures.
    `static <T1,T2,T3,T4> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4)` Like `any(Future, Future)` but with 4 futures.
    `static <T1,T2,T3,T4,T5> CompositeFuture` | `any(Future<T1> f1, Future<T2> f2, Future<T3> f3, Future<T4> f4, Future<T5> f5)` Like `any(Future, Future)` but with 5 futures.
    `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)` Like `any(Future, Future)` but with 6 futures.
    `static CompositeFuture` | `any(List<Future> futures)` Like `any(Future, Future)` but with a list of futures.
    `Throwable` | `cause(int index)` Returns a cause of a wrapped future
    `boolean` | `failed(int index)` Returns true if a wrapped future is failed
    `boolean` | `isComplete(int index)` Returns true if a wrapped future is completed
    `default <T> List<T>` | `list()`
    `<T> T` | `result(int index)` Returns the result of a wrapped future
    `CompositeFuture` | `setHandler(Handler<AsyncResult<CompositeFuture>> handler)` Set a handler for the result.
    `int` | `size()`
    `boolean` | `succeeded(int index)` Returns true if a wrapped future is succeeded

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

      `cause, complete, complete, completer, compose, compose, fail, fail, failed, failedFuture, failedFuture, future, isComplete, map, map, result, succeeded, succeededFuture, succeededFuture`

- - ### Method Detail

    - #### all

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

      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

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

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

    - #### all

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

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

    - #### all

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

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

    - #### all

          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)

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

    - #### all

          static CompositeFuture all(List<Future> futures)

      Like `all(Future, Future)` but with a list of futures.

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

    - #### any

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

      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

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

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

    - #### any

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

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

    - #### any

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

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

    - #### any

          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)

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

    - #### any

          static CompositeFuture any(List<Future> futures)

      Like `any(Future, Future)` but with a list of futures.

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

    - #### setHandler

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

      Description copied from interface: `Future`
      Set a handler for the result.

      If the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.

      Specified by:
        `setHandler` 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

    - #### 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

    - #### result

          <T> T result(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

Copyright © 2016. All rights reserved.