org.apache.http.concurrent

## Class BasicFuture<T>

- java.lang.Object
- - org.apache.http.concurrent.BasicFuture<T>

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

      public class BasicFuture<T>
      extends Object
      implements Future<T>, Cancellable

  Basic implementation of the `Future` interface. `BasicFuture`can be put into a completed state by invoking any of the following methods: `cancel()`, `failed(Exception)`, or `completed(Object)`.``
  Since:
    4.2

- - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancel()`
    `boolean` | `cancel(boolean mayInterruptIfRunning)`
    `boolean` | `completed(T result)`
    `boolean` | `failed(Exception exception)`
    `T` | `get()`
    `T` | `get(long timeout, TimeUnit unit)`
    `boolean` | `isCancelled()`
    `boolean` | `isDone()`

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

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

- - ### Constructor Detail

    - #### BasicFuture

          public BasicFuture(FutureCallback<T> callback)

  - ### Method Detail

    - #### isCancelled

          public boolean isCancelled()

      Specified by:
        `isCancelled` in interface `Future<T>`

    - #### isDone

          public boolean isDone()

      Specified by:
        `isDone` in interface `Future<T>`

    - #### get

          public T get()
                throws InterruptedException,
                       ExecutionException

      Specified by:
        `get` in interface `Future<T>`
      Throws:
        `InterruptedException`
        `ExecutionException`

    - #### get

          public T get(long timeout,
              TimeUnit unit)
                throws InterruptedException,
                       ExecutionException,
                       TimeoutException

      Specified by:
        `get` in interface `Future<T>`
      Throws:
        `InterruptedException`
        `ExecutionException`
        `TimeoutException`

    - #### completed

          public boolean completed(T result)

    - #### failed

          public boolean failed(Exception exception)

    - #### cancel

          public boolean cancel(boolean mayInterruptIfRunning)

      Specified by:
        `cancel` in interface `Future<T>`

    - #### cancel

          public boolean cancel()

      Specified by:
        `cancel` in interface `Cancellable`

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