org.apache.hc.core5.concurrent

## Class ComplexFuture<T>

- java.lang.Object
- - org.apache.hc.core5.concurrent.BasicFuture<T>
  - - org.apache.hc.core5.concurrent.ComplexFuture<T>

- Type Parameters:
    `T` - the future result type of an asynchronous operation.
  All Implemented Interfaces:
    Future<T>, Cancellable, CancellableDependency

      public final class ComplexFuture<T>
      extends BasicFuture<T>
      implements CancellableDependency

  `Future` whose result depends on another `Cancellable` process or operation or another `Future`. Dependent process will get cancelled if the future itself is cancelled.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComplexFuture(FutureCallback<T> callback)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancel(boolean mayInterruptIfRunning)`
    `boolean` | `completed(T result)`
    `boolean` | `failed(Exception exception)`
    `void` | `setDependency(Cancellable dependency)` Sets `Cancellable` dependency on another ongoing process or operation represented by `Cancellable`.
    `void` | `setDependency(Future<?> dependency)`

    - ### Methods inherited from class org.apache.hc.core5.concurrent.BasicFuture

      `cancel, get, get, isCancelled, isDone`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.hc.core5.concurrent.CancellableDependency

      `isCancelled`

    - ### Methods inherited from interface org.apache.hc.core5.concurrent.Cancellable

      `cancel`

- - ### Constructor Detail

    - #### ComplexFuture

          public ComplexFuture(FutureCallback<T> callback)

  - ### Method Detail

    - #### setDependency

          public void setDependency(Cancellable dependency)

      Description copied from interface: `CancellableDependency`
      Sets `Cancellable` dependency on another ongoing process or operation represented by `Cancellable`.
      Specified by:
        `setDependency` in interface `CancellableDependency`
      Parameters:
        `dependency` - another ongoing process or operation.

    - #### setDependency

          public void setDependency(Future<?> dependency)

    - #### completed

          public boolean completed(T result)

      Overrides:
        `completed` in class `BasicFuture<T>`

    - #### failed

          public boolean failed(Exception exception)

      Overrides:
        `failed` in class `BasicFuture<T>`

    - #### cancel

          public boolean cancel(boolean mayInterruptIfRunning)

      Specified by:
        `cancel` in interface `Future<T>`
      Overrides:
        `cancel` in class `BasicFuture<T>`

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.