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 standardFutureinterface. 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 Modifier and Type Method Description booleancancel()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 whendoneCbis executed.<T> IgniteInternalFuture<T>chainCompose(IgniteClosure<? super IgniteInternalFuture<R>,IgniteInternalFuture<T>> doneCb, Executor exec)Make a chained future that is completed whendoneCbis executed.Throwableerror()Rget()Synchronously waits for completion of the computation and returns computation result.Rget(long timeout)Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.Rget(long timeout, TimeUnit unit)Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.RgetUninterruptibly()Synchronously waits for completion of the computation and returns computation result ignoring interrupts.booleanisCancelled()Returnstrueif this computation was cancelled before it completed normally.booleanisDone()Checks if computation is done.voidlisten(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)Registers listener closure to be asynchronously notified whenever future completes.voidlisten(IgniteRunnable lsnr)Registers listener closure to be asynchronously notified whenever future completes.Rresult()
-
-
-
Method Detail
-
get
R get() throws IgniteCheckedException
Synchronously waits for completion of the computation and returns computation result.- Returns:
- Computation result.
- Throws:
IgniteInterruptedCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was interrupted.IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows 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 callingget(long, TimeUnit.MILLISECONDS).- Parameters:
timeout- The maximum time to wait in milliseconds.- Returns:
- Computation result.
- Throws:
IgniteInterruptedCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was interrupted.IgniteFutureTimeoutCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was timed out.IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows 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 thetimeoutargument.- Returns:
- Computation result.
- Throws:
IgniteInterruptedCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was interrupted.IgniteFutureTimeoutCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was timed out.IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows 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 ofIgniteCheckedExceptionthrows if computation was cancelled.IgniteCheckedException- If computation failed.
-
cancel
boolean cancel() throws IgniteCheckedExceptionCancels this future.- Returns:
Trueif 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:
Trueif computation is done,falseotherwise.
-
isCancelled
boolean isCancelled()
Returnstrueif this computation was cancelled before it completed normally.- Returns:
Trueif 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 whendoneCbis 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 whendoneCbis 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.
-
-