public class GridFutureAdapter<R> extends Object implements IgniteInternalFuture<R>
Constructor and Description |
---|
GridFutureAdapter() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Default no-op implementation that always returns
false . |
<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.
|
void |
ignoreInterrupts()
Determines whether the future will ignore interrupts.
|
boolean |
isCancelled()
Returns
true if this computation was cancelled before it completed normally. |
boolean |
isDone()
Checks if computation is done.
|
boolean |
isFailed() |
void |
listen(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
Registers listener closure to be asynchronously notified whenever future completes.
|
IgniteLogger |
logger() |
boolean |
onCancelled()
Callback to notify that future is cancelled.
|
boolean |
onDone()
Callback to notify that future is finished with
null result. |
boolean |
onDone(R res)
Callback to notify that future is finished.
|
boolean |
onDone(R res,
Throwable err)
Callback to notify that future is finished.
|
protected boolean |
onDone(R res,
Throwable err,
boolean cancel) |
boolean |
onDone(Throwable err)
Callback to notify that future is finished.
|
R |
result() |
String |
toString() |
public void ignoreInterrupts()
public Throwable error()
error
in interface IgniteInternalFuture<R>
public R result()
result
in interface IgniteInternalFuture<R>
public R get() throws IgniteCheckedException
get
in interface IgniteInternalFuture<R>
IgniteInterruptedCheckedException
- Subclass of IgniteCheckedException
thrown if the wait was interrupted.IgniteFutureCancelledCheckedException
- Subclass of IgniteCheckedException
throws if computation was cancelled.IgniteCheckedException
- If computation failed.public R getUninterruptibly() throws IgniteCheckedException
getUninterruptibly
in interface IgniteInternalFuture<R>
IgniteFutureCancelledCheckedException
- Subclass of IgniteCheckedException
throws if computation
was cancelled.IgniteCheckedException
- If computation failed.public R get(long timeout) throws IgniteCheckedException
get(long, TimeUnit.MILLISECONDS)
.get
in interface IgniteInternalFuture<R>
timeout
- The maximum time to wait in milliseconds.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.public R get(long timeout, TimeUnit unit) throws IgniteCheckedException
get
in interface IgniteInternalFuture<R>
timeout
- The maximum time to wait.unit
- The time unit of the timeout
argument.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.public void listen(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
listen
in interface IgniteInternalFuture<R>
lsnr
- Listener closure to register. If not provided - this method is no-op.public <T> IgniteInternalFuture<T> chain(IgniteClosure<? super IgniteInternalFuture<R>,T> doneCb)
chain
in interface IgniteInternalFuture<R>
doneCb
- Done callback that is applied to this future when it finishes to produce chained future result.public <T> IgniteInternalFuture<T> chain(IgniteClosure<? super IgniteInternalFuture<R>,T> doneCb, Executor exec)
chain
in interface IgniteInternalFuture<R>
doneCb
- Done callback that is applied to this future when it finishes to produce chained future result.exec
- Executor to run callback.@Nullable public IgniteLogger logger()
public boolean cancel() throws IgniteCheckedException
false
.
Futures that do support cancellation should override this method
and call onCancelled()
callback explicitly if cancellation
indeed did happen.cancel
in interface IgniteInternalFuture<R>
True
if future was canceled (i.e. was not finished prior to this call).IgniteCheckedException
- If cancellation failed.public boolean isDone()
isDone
in interface IgniteInternalFuture<R>
True
if computation is done, false
otherwise.public boolean isFailed()
True
if future is completed with exception.public boolean isCancelled()
true
if this computation was cancelled before it completed normally.isCancelled
in interface IgniteInternalFuture<R>
True
if this computation was cancelled before it completed normally.public final boolean onDone()
null
result.
This method must delegate to onDone(Object, Throwable)
method.True
if result was set by this call.public final boolean onDone(@Nullable R res)
onDone(Object, Throwable)
method.res
- Result.True
if result was set by this call.public final boolean onDone(@Nullable Throwable err)
onDone(Object, Throwable)
method.err
- Error.True
if result was set by this call.public boolean onDone(@Nullable R res, @Nullable Throwable err)
null
exception is passed in
the result value will be ignored.res
- Optional result.err
- Optional error.True
if result was set by this call.protected boolean onDone(@Nullable R res, @Nullable Throwable err, boolean cancel)
res
- Result.err
- Error.cancel
- True
if future is being cancelled.True
if result was set by this call.public boolean onCancelled()
True
if cancel flag was set by this call.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017