Package org.apache.ignite.internal

## Interface IgniteInternalFuture<R>

Type Parameters:
  `R` - Type of the result for the future.

All Known Subinterfaces:
  `CacheQueryFuture<T>`, `GridCacheAtomicFuture<R>`, `GridCacheFuture<R>`, `GridCacheVersionedFuture<T>`, `GridDhtFuture<T>`, `GridDhtTopologyFuture`, `GridNioFuture<R>`, `NearTxFinishFuture`

All Known Implementing Classes:
  `AbstractCreateSnapshotFutureTask`, `CacheDistributedGetFutureAdapter`, `CacheDistributedGetFutureAdapter.AbstractMiniFuture`, `CacheObjectsReleaseFuture`, `ComputeTaskInternalFuture`, `ConnectFuture`, `ConnectionRequestFuture`, `CountDownFuture`, `CreateDumpFutureTask`, `FutureTask`, `GridCacheCompoundFuture`, `GridCacheCompoundIdentityFuture`, `GridCacheDistributedFieldsQueryFuture`, `GridCacheDistributedQueryFuture`, `GridCacheFutureAdapter`, `GridCacheLocalFieldsQueryFuture`, `GridCacheLocalQueryFuture`, `GridCacheMultiTxFuture`, `GridCacheQueryErrorFuture`, `GridCacheQueryFutureAdapter`, `GridCacheQueryManager.QueryResult`, `GridCacheTxRecoveryFuture`, `GridCompoundFuture`, `GridCompoundIdentityFuture`, `GridCompoundReadRepairFuture`, `GridDhtAssignmentFetchFuture`, `GridDhtAtomicAbstractUpdateFuture`, `GridDhtColocatedLockFuture`, `GridDhtEmbeddedFuture`, `GridDhtFinishedFuture`, `GridDhtForceKeysFuture`, `GridDhtGetFuture`, `GridDhtGetSingleFuture`, `GridDhtLockFuture`, `GridDhtPartitionDemander.RebalanceFuture`, `GridDhtPartitionsExchangeFuture`, `GridDhtTopologyFutureAdapter`, `GridDhtTxFinishFuture`, `GridDhtTxPrepareFuture`, `GridEmbeddedFuture`, `GridEncryptionManager.KeyChangeFuture`, `GridFinishedFuture`, `GridFutureAdapter`, `GridNearAtomicAbstractUpdateFuture`, `GridNearAtomicSingleUpdateFuture`, `GridNearAtomicUpdateFuture`, `GridNearGetFuture`, `GridNearLockFuture`, `GridNearOptimisticSerializableTxPrepareFuture`, `GridNearOptimisticTxPrepareFuture`, `GridNearOptimisticTxPrepareFutureAdapter`, `GridNearOptimisticTxPrepareFutureAdapter.KeyLockFuture`, `GridNearPessimisticTxPrepareFuture`, `GridNearReadRepairAbstractFuture`, `GridNearReadRepairCheckOnlyFuture`, `GridNearReadRepairFuture`, `GridNearTxFastFinishFuture`, `GridNearTxFinishFuture`, `GridNearTxPrepareFutureAdapter`, `GridNioEmbeddedFuture`, `GridNioFinishedFuture`, `GridNioFutureImpl`, `GridPartitionedGetFuture`, `GridPartitionedSingleGetFuture`, `GridServiceDeploymentCompoundFuture`, `GridServiceDeploymentFuture`, `GridWorkerFuture`, `IgniteSnapshotManager.ClusterSnapshotFuture`, `InitNewCoordinatorFuture`, `PlatformCompute.ComputeConvertingFuture`, `QueryRunningFuture`, `SchemaIndexCacheCompoundFuture`, `SchemaIndexCacheFuture`, `SchemaOperationClientFuture`, `SnapshotFinishedFutureTask`, `SnapshotResponseRemoteFutureTask`, `StopCachesOnClientReconnectExchangeTask`, `TcpCommunicationConnectionCheckFuture`

    public interface IgniteInternalFuture<R>

Extension for standard `Future` interface. It adds simplified exception handling, functional programming support and ability to listen for future completion via functional callback.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `cancel()` Cancels this future.
`<T> IgniteInternalFuture<T>` `chain​(IgniteClosure<? super IgniteInternalFuture<R>,​T> doneCb)` Make a chained future to convert result of this future (when complete) into a new format.
`<T> IgniteInternalFuture<T>` `chain​(IgniteClosure<? super IgniteInternalFuture<R>,​T> doneCb, Executor exec)` Make a chained future to convert result of this future (when complete) into a new format.
`<T> IgniteInternalFuture<T>` `chain​(IgniteOutClosure<T> doneCb)` Make a chained future to convert result of this future (when complete) into a new format.
`<T> IgniteInternalFuture<T>` `chain​(IgniteOutClosure<T> doneCb, Executor exec)` Make a chained future to convert result of this future (when complete) into a new format.
`<T> IgniteInternalFuture<T>` `chainCompose​(IgniteClosure<? super IgniteInternalFuture<R>,​IgniteInternalFuture<T>> doneCb)` Make a chained future that is completed when `doneCb` is executed.
`<T> IgniteInternalFuture<T>` `chainCompose​(IgniteClosure<? super IgniteInternalFuture<R>,​IgniteInternalFuture<T>> doneCb, Executor exec)` Make a chained future that is completed when `doneCb` is executed.
`Throwable` `error()`
`R` `get()` Synchronously waits for completion of the computation and returns computation result.
`R` `get​(long timeout)` Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.
`R` `get​(long timeout, TimeUnit unit)` Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.
`R` `getUninterruptibly()` Synchronously waits for completion of the computation and returns computation result ignoring interrupts.
`boolean` `isCancelled()` Returns `true` if this computation was cancelled before it completed normally.
`boolean` `isDone()` Checks if computation is done.
`void` `listen​(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)` Registers listener closure to be asynchronously notified whenever future completes.
`void` `listen​(IgniteRunnable lsnr)` Registers listener closure to be asynchronously notified whenever future completes.
`R` `result()`

### Method Detail

#### get

    R get()
    throws IgniteCheckedException

Synchronously waits for completion of the computation and returns computation result.

Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### get

    R get​(long timeout)
    throws IgniteCheckedException

Synchronously waits for completion of the computation for up to the timeout specified and returns computation result. This method is equivalent to calling `get(long, TimeUnit.MILLISECONDS)`.

Parameters:
  `timeout` - The maximum time to wait in milliseconds.
Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureTimeoutCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was timed out.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### get

    R get​(long timeout,
          TimeUnit unit)
    throws IgniteCheckedException

Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.

Parameters:
  `timeout` - The maximum time to wait.
  `unit` - The time unit of the `timeout` argument.
Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureTimeoutCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was timed out.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### getUninterruptibly

    R getUninterruptibly()
                  throws IgniteCheckedException

Synchronously waits for completion of the computation and returns computation result ignoring interrupts.

Returns:
  Computation result.
Throws:
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### cancel

    boolean cancel()
            throws IgniteCheckedException

Cancels this future.

Returns:
  `True` if future was canceled (i.e. was not finished prior to this call).
Throws:
  `IgniteCheckedException` - If cancellation failed.

#### isDone

    boolean isDone()

Checks if computation is done.

Returns:
  `True` if computation is done, `false` otherwise.

#### isCancelled

    boolean isCancelled()

Returns `true` if this computation was cancelled before it completed normally.

Returns:
  `True` if this computation was cancelled before it completed normally.

#### listen

    void listen​(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)

Registers listener closure to be asynchronously notified whenever future completes.

Parameters:
  `lsnr` - Listener closure to register.

#### listen

    void listen​(IgniteRunnable lsnr)

Registers listener closure to be asynchronously notified whenever future completes.

Parameters:
  `lsnr` - Listener closure to register.

#### chain

    <T> IgniteInternalFuture<T> chain​(IgniteClosure<? super IgniteInternalFuture<R>,​T> doneCb)

Make a chained future to convert result of this future (when complete) into a new format. It is guaranteed that done callback will be called only ONCE.

Parameters:
  `doneCb` - Done callback that is applied to this future when it finishes to produce chained future result.
Returns:
  Chained future that finishes after this future completes and done callback is called.

#### chain

    <T> IgniteInternalFuture<T> chain​(IgniteOutClosure<T> doneCb)

Make a chained future to convert result of this future (when complete) into a new format. It is guaranteed that done callback will be called only ONCE.

Parameters:
  `doneCb` - Done callback that is applied to this future when it finishes to produce chained future result.
Returns:
  Chained future that finishes after this future completes and done callback is called.

#### chain

    <T> IgniteInternalFuture<T> chain​(IgniteClosure<? super IgniteInternalFuture<R>,​T> doneCb,
                                      Executor exec)

Make a chained future to convert result of this future (when complete) into a new format. It is guaranteed that done callback will be called only ONCE.

Parameters:
  `doneCb` - Done callback that is applied to this future when it finishes to produce chained future result.
  `exec` - Executor to run callback.
Returns:
  Chained future that finishes after this future completes and done callback is called.

#### chain

    <T> IgniteInternalFuture<T> chain​(IgniteOutClosure<T> doneCb,
                                      Executor exec)

Make a chained future to convert result of this future (when complete) into a new format. It is guaranteed that done callback will be called only ONCE.

Parameters:
  `doneCb` - Done callback that is applied to this future when it finishes to produce chained future result.
  `exec` - Executor to run callback.
Returns:
  Chained future that finishes after this future completes and done callback is called.

#### chainCompose

    <T> IgniteInternalFuture<T> chainCompose​(IgniteClosure<? super IgniteInternalFuture<R>,​IgniteInternalFuture<T>> doneCb)

Make a chained future that is completed when `doneCb` is executed. Callback is called with this future as the argument, when this future completes. It is guaranteed that done callback will be called only ONCE.

Type Parameters:
  `T` - Type parameter.
Parameters:
  `doneCb` - Done callback.
Returns:
  Chained future.

#### chainCompose

    <T> IgniteInternalFuture<T> chainCompose​(IgniteClosure<? super IgniteInternalFuture<R>,​IgniteInternalFuture<T>> doneCb,
                                             Executor exec)

Make a chained future that is completed when `doneCb` is executed. Callback is called with this future as the argument, when this future completes. It is guaranteed that done callback will be called only ONCE.

Type Parameters:
  `T` - Type parameter.
Parameters:
  `doneCb` - Done callback.
  `exec` - Executor to run callback.
Returns:
  Chained future.

#### error

    Throwable error()

Returns:
  Error value if future has already been completed with error.

#### result

    R result()

Returns:
  Result value if future has already been completed normally.