public class GridFinishedFutureEx<T> extends Object implements IgniteInternalFuture<T>, Externalizable
GridFinishedFuture as it does not take context as a parameter and
performs notifications in the same thread.| Constructor and Description |
|---|
GridFinishedFutureEx()
Created finished future with
null value. |
GridFinishedFutureEx(T t)
Creates finished future with complete value.
|
GridFinishedFutureEx(Throwable err) |
GridFinishedFutureEx(T t,
Throwable err)
Creates finished future with complete value and error.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel()
Cancels this future.
|
<R> IgniteInternalFuture<R> |
chain(IgniteClosure<? super IgniteInternalFuture<T>,R> doneCb)
Make a chained future to convert result of this future (when complete) into a new format.
|
boolean |
concurrentNotify()
Gets value concurrent listener notification flag.
|
void |
concurrentNotify(boolean concurNotify)
Flag to turn on or off concurrent listener notification.
|
long |
duration()
Gets duration in milliseconds between start of the future and current time if future
is not finished, or between start and finish of this future.
|
protected boolean |
failed() |
T |
get()
Synchronously waits for completion of the computation and
returns computation result.
|
T |
get(long timeout)
Synchronously waits for completion of the computation for
up to the timeout specified and returns computation result.
|
T |
get(long timeout,
TimeUnit unit)
Synchronously waits for completion of the computation for
up to the timeout specified and returns computation result.
|
boolean |
isCancelled()
Returns
true if this computation was cancelled before it completed normally. |
boolean |
isDone()
Checks if computation is done.
|
void |
listenAsync(IgniteInClosure<? super IgniteInternalFuture<T>> lsnr)
Registers listener closure to be asynchronously notified whenever future completes.
|
void |
readExternal(ObjectInput in) |
long |
startTime()
Gets start time for this future.
|
void |
stopListenAsync(IgniteInClosure<? super IgniteInternalFuture<T>>... lsnr)
Removes given listeners from the future.
|
boolean |
syncNotify()
Gets value of synchronous listener notification flag.
|
void |
syncNotify(boolean syncNotify)
Flag to turn on or off synchronous listener notification.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public GridFinishedFutureEx()
null value.public GridFinishedFutureEx(T t)
t - Finished value.public GridFinishedFutureEx(Throwable err)
err - Future error.public long startTime()
startTime in interface IgniteInternalFuture<T>public long duration()
duration in interface IgniteInternalFuture<T>public boolean concurrentNotify()
true,
then all listeners will be notified concurrently by different threads; otherwise,
listeners will be notified one after another within one thread (depending on
IgniteInternalFuture.syncNotify() flag, these notifications may happen either in the same thread which
started the future, or in a different thread).
Default value is false. To change the default, set
IgniteSystemProperties.IGNITE_FUT_CONCURRENT_NOTIFICATION system property to true.
concurrentNotify in interface IgniteInternalFuture<T>public void concurrentNotify(boolean concurNotify)
true,
then all listeners will be notified concurrently by different threads; otherwise,
listeners will be notified one after another within one thread (depending on
IgniteInternalFuture.syncNotify() flag, these notifications may happen either in the same thread which
started the future, or in a different thread).
Default value is false. To change the default, set
IgniteSystemProperties.IGNITE_FUT_CONCURRENT_NOTIFICATION system property to true.
concurrentNotify in interface IgniteInternalFuture<T>concurNotify - Flag to turn on or off concurrent listener notification.public void syncNotify(boolean syncNotify)
true, then
upon future completion the notification may happen in the same thread that created
the future. This becomes especially important when adding listener to a future that
is already done - if this flag is true, then listener will be
immediately notified within the same thread.
Default value is false. To change the default, set
IgniteSystemProperties.IGNITE_FUT_SYNC_NOTIFICATION system property to true.
syncNotify in interface IgniteInternalFuture<T>syncNotify - Flag to turn on or off synchronous listener notification.public boolean syncNotify()
true, then
upon future completion the notification may happen in the same thread that created
the future. This becomes especially important when adding listener to a future that
is already done - if this flag is true, then listener will be
immediately notified within the same thread.
Default value is false. To change the default, set
IgniteSystemProperties.IGNITE_FUT_SYNC_NOTIFICATION system property to true.
syncNotify in interface IgniteInternalFuture<T>public boolean cancel()
cancel in interface IgniteInternalFuture<T>True if future was canceled (i.e. was not finished prior to this call).public boolean isCancelled()
true if this computation was cancelled before it completed normally.isCancelled in interface IgniteInternalFuture<T>True if this computation was cancelled before it completed normally.public boolean isDone()
isDone in interface IgniteInternalFuture<T>True if computation is done, false otherwise.public T get() throws IgniteCheckedException
get in interface IgniteInternalFuture<T>IgniteInterruptedCheckedException - Subclass of IgniteCheckedException thrown if the wait was interrupted.IgniteFutureCancelledCheckedException - Subclass of IgniteCheckedException throws if computation was cancelled.IgniteCheckedException - If computation failed.public T get(long timeout) throws IgniteCheckedException
get(long, TimeUnit.MILLISECONDS).get in interface IgniteInternalFuture<T>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 T get(long timeout, TimeUnit unit) throws IgniteCheckedException
get in interface IgniteInternalFuture<T>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 <R> IgniteInternalFuture<R> chain(IgniteClosure<? super IgniteInternalFuture<T>,R> doneCb)
chain in interface IgniteInternalFuture<T>doneCb - Done callback that is applied to this future when it finishes to produce chained future result.public void listenAsync(IgniteInClosure<? super IgniteInternalFuture<T>> lsnr)
listenAsync in interface IgniteInternalFuture<T>lsnr - Listener closure to register. If not provided - this method is no-op.public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteInternalFuture<T>>... lsnr)
stopListenAsync in interface IgniteInternalFuture<T>lsnr - Listeners to remove.protected boolean failed()
True if future failed.public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015