org.apache.ignite.internal

## Interface IgniteInternalFuture<R>

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

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

All Known Implementing Classes:
  CacheDistributedGetFutureAdapter, CacheObjectsReleaseFuture, ClientCacheDhtTopologyFuture, CompoundLockFuture, ComputeTaskInternalFuture, CountDownFuture, GridCacheCompoundFuture, GridCacheCompoundIdentityFuture, GridCacheDistributedFieldsQueryFuture, GridCacheDistributedQueryFuture, GridCacheFutureAdapter, GridCacheLocalFieldsQueryFuture, GridCacheLocalQueryFuture, GridCacheMultiTxFuture, GridCacheQueryErrorFuture, GridCacheQueryFutureAdapter, GridCacheTxRecoveryFuture, GridCompoundFuture, GridCompoundIdentityFuture, GridDhtAssignmentFetchFuture, GridDhtAtomicAbstractUpdateFuture, GridDhtColocatedLockFuture, GridDhtEmbeddedFuture, GridDhtFinishedFuture, GridDhtForceKeysFuture, GridDhtGetFuture, GridDhtGetSingleFuture, GridDhtLockFuture, GridDhtPartitionDemander.RebalanceFuture, GridDhtPartitionsExchangeFuture, GridDhtTopologyFutureAdapter, GridDhtTxAbstractEnlistFuture, GridDhtTxEnlistFuture, GridDhtTxFinishFuture, GridDhtTxPrepareFuture, GridDhtTxQueryAbstractEnlistFuture, GridDhtTxQueryEnlistFuture, GridDhtTxQueryResultsEnlistFuture, GridEmbeddedFuture, GridFinishedFuture, GridFutureAdapter, GridLocalLockFuture, GridNearAtomicAbstractUpdateFuture, GridNearAtomicSingleUpdateFuture, GridNearAtomicUpdateFuture, GridNearGetFuture, GridNearLockFuture, GridNearOptimisticSerializableTxPrepareFuture, GridNearOptimisticTxPrepareFuture, GridNearOptimisticTxPrepareFutureAdapter, GridNearOptimisticTxPrepareFutureAdapter.KeyLockFuture, GridNearPessimisticTxPrepareFuture, GridNearTxAbstractEnlistFuture, GridNearTxEnlistFuture, GridNearTxFastFinishFuture, GridNearTxFinishAndAckFuture, GridNearTxFinishFuture, GridNearTxPrepareFutureAdapter, GridNearTxQueryAbstractEnlistFuture, GridNearTxQueryEnlistFuture, GridNearTxQueryResultsEnlistFuture, GridNearTxSelectForUpdateFuture, GridNioEmbeddedFuture, GridNioFinishedFuture, GridNioFutureImpl, GridPartitionedGetFuture, GridPartitionedSingleGetFuture, GridServiceDeploymentCompoundFuture, GridServiceDeploymentFuture, GridWorkerFuture, InitNewCoordinatorFuture, MvccFuture, MvccSnapshotFuture, PartitionCountersNeighborcastFuture, PlatformCompute.ComputeConvertingFuture, SchemaOperationClientFuture, StopCachesOnClientReconnectExchangeTask, TcpCommunicationConnectionCheckFuture, TxTopologyVersionFuture, VacuumTask

    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.
`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.
`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. If not provided - this method is no-op.

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

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

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018