com.hazelcast.client.util

## Class ClientDelegatingFuture<V>

- java.lang.Object
- - com.hazelcast.client.util.ClientDelegatingFuture<V>

- Type Parameters:
    `V` - Value type that the user expects
  All Implemented Interfaces:
    ICompletableFuture<V>, InternalCompletableFuture<V>, Future<V>
  Direct Known Subclasses:
    IExecutorDelegatingFuture

      public class ClientDelegatingFuture<V>
      extends Object
      implements InternalCompletableFuture<V>

  The Client Delegating Future is used to delegate `ClientInvocationFuture` to a user type to be used with `andThen()` or `get()`. It converts `ClientMessage` coming from `ClientInvocationFuture` to a user object.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture, SerializationService serializationService, com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder)`
    `ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture, SerializationService serializationService, com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder, boolean deserializeResponse)`
    `ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture, SerializationService serializationService, com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder, V defaultValue)`
    `ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture, SerializationService serializationService, com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder, V defaultValue, boolean deserializeResponse)`

  - ### 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)`
    `protected com.hazelcast.client.spi.impl.ClientInvocationFuture` | `getFuture()`
    `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

    - #### ClientDelegatingFuture

          public ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture,
                                        SerializationService serializationService,
                                        com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder,
                                        V defaultValue,
                                        boolean deserializeResponse)

    - #### ClientDelegatingFuture

          public ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture,
                                        SerializationService serializationService,
                                        com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder,
                                        V defaultValue)

    - #### ClientDelegatingFuture

          public ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture,
                                        SerializationService serializationService,
                                        com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder)

    - #### ClientDelegatingFuture

          public ClientDelegatingFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture clientInvocationFuture,
                                        SerializationService serializationService,
                                        com.hazelcast.client.impl.clientside.ClientMessageDecoder clientMessageDecoder,
                                        boolean deserializeResponse)

  - ### Method Detail

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

    - #### 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 final boolean isDone()

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

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

    - #### getFuture

          protected com.hazelcast.client.spi.impl.ClientInvocationFuture getFuture()

Copyright © 2019. All rights reserved.