com.hazelcast.util.executor

## Class CompletedFuture<V>

- java.lang.Object
- - com.hazelcast.util.executor.CompletedFuture<V>

- All Implemented Interfaces:
    ICompletableFuture<V>, InternalCompletableFuture<V>, Future<V>

      public final class CompletedFuture<V>
      extends Object
      implements InternalCompletableFuture<V>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompletedFuture(SerializationService serializationService, Object value, Executor userExecutor)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `andThen(ExecutionCallback<V> callback)` Registers a callback that will run after this future is completed.
    `void` | `andThen(ExecutionCallback<V> callback, Executor executor)` Registers a callback that will run with the provided executor after this future is completed.
    `boolean` | `cancel(boolean mayInterruptIfRunning)`
    `boolean` | `complete(Object value)` Completes this future.
    `V` | `get()`
    `V` | `get(long timeout, TimeUnit unit)`
    `boolean` | `isCancelled()`
    `boolean` | `isDone()`
    `V` | `join()` Waits for this future to complete.

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

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

- - ### Constructor Detail

    - #### CompletedFuture

          public CompletedFuture(SerializationService serializationService,
                                 Object value,
                                 Executor userExecutor)

  - ### Method Detail

    - #### get

          public V get()
                throws InterruptedException,
                       ExecutionException

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

    - #### get

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

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

    - #### join

          public V join()

      Description copied from interface: `InternalCompletableFuture`
      Waits for this future to complete.
      Specified by:
        `join` in interface `InternalCompletableFuture<V>`
      Returns:
        the result.

    - #### complete

          public boolean complete(Object value)

      Description copied from interface: `InternalCompletableFuture`
      Completes this future.
      Specified by:
        `complete` in interface `InternalCompletableFuture<V>`
      Parameters:
        `value` - the value to complete this future with.
      Returns:
        `true` if this invocation caused this InternalCompletableFuture to complete, else `false`

    - #### cancel

          public boolean cancel(boolean mayInterruptIfRunning)

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

    - #### isCancelled

          public boolean isCancelled()

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

    - #### isDone

          public boolean isDone()

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

    - #### andThen

          public void andThen(ExecutionCallback<V> callback)

      Description copied from interface: `ICompletableFuture`
      Registers a callback that will run after this future is completed. If this future is already completed, it runs immediately.

      Please note that there is no ordering guarantee for running multiple callbacks. It is also not guaranteed that the callback will run within the same thread that completes the future.

      Specified by:
        `andThen` in interface `ICompletableFuture<V>`
      Parameters:
        `callback` - the callback to execute

    - #### andThen

          public void andThen(ExecutionCallback<V> callback,
                              Executor executor)

      Description copied from interface: `ICompletableFuture`
      Registers a callback that will run with the provided executor after this future is completed. If this future is already completed, it runs immediately. The callback is called using the given `executor`. Please note that there is no ordering guarantee for executing multiple callbacks.
      Specified by:
        `andThen` in interface `ICompletableFuture<V>`
      Parameters:
        `callback` - the callback to execute
        `executor` - the executor in which the callback will be run

Copyright © 2019. All rights reserved.