GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid
Interface GridTaskFuture<R>

Type Parameters:
R - Type of the task result returning from GridTask.reduce(List) method.
All Superinterfaces:
Callable<R>, GridFuture<R>, GridMetadataAware, Serializable

public interface GridTaskFuture<R>
extends GridFuture<R>

This class defines a handler for asynchronous task execution. It's similar in design to standard JDK Future interface but has improved and easier to use exception hierarchy.

Wiki & Forum:


Wiki
Forum

 

Method Summary
 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.
 GridTaskSession getTaskSession()
          Gets task session of execution grid task.
 boolean isMapped()
          Checks if "map" step has completed (which means that GridTask.map(List, Object) method has finished).
 boolean waitForMap()
          Waits until GridTask.map(List, Object) method completes.
 boolean waitForMap(long timeout)
          Waits for a specified timeout in milliseconds for GridTask.map(List, Object) method to complete.
 boolean waitForMap(long timeout, TimeUnit unit)
          Waits for a specified timeout in milliseconds for GridTask.map(List, Object) method to complete.
 
Methods inherited from interface org.gridgain.grid.GridFuture
cancel, concurrentNotify, concurrentNotify, duration, isCancelled, isDone, listenAsync, predicate, startTime, stopListenAsync, syncNotify, syncNotify
 
Methods inherited from interface org.gridgain.grid.GridMetadataAware
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Method Detail

get

R get()
      throws GridException
Synchronously waits for completion of the computation and returns computation result.

Specified by:
get in interface GridFuture<R>
Throws:
GridTaskTimeoutException - If task execution timed out.
GridInterruptedException - Subclass of GridException thrown if the wait was interrupted.
GridFutureCancelledException - Subclass of GridException throws if computation was cancelled.
GridException - If computation failed.
Returns:
Computation result.

get

R get(long timeout)
      throws GridException
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).

Specified by:
get in interface GridFuture<R>
Throws:
GridTaskTimeoutException - If task execution timed out.
GridInterruptedException - Subclass of GridException thrown if the wait was interrupted.
GridFutureTimeoutException - Subclass of GridException thrown if the wait was timed out.
GridFutureCancelledException - Subclass of GridException throws if computation was cancelled.
GridException - If computation failed.
Parameters:
timeout - The maximum time to wait in milliseconds.
Returns:
Computation result.

get

R get(long timeout,
      TimeUnit unit)
      throws GridException
Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.

Specified by:
get in interface GridFuture<R>
Throws:
GridTaskTimeoutException - If task execution timed out.
GridInterruptedException - Subclass of GridException thrown if the wait was interrupted.
GridFutureTimeoutException - Subclass of GridException thrown if the wait was timed out.
GridFutureCancelledException - Subclass of GridException throws if computation was cancelled.
GridException - If computation failed.
Parameters:
timeout - The maximum time to wait.
unit - The time unit of the timeout argument.
Returns:
Computation result.

getTaskSession

GridTaskSession getTaskSession()
Gets task session of execution grid task.

Returns:
Task session.

isMapped

boolean isMapped()
Checks if "map" step has completed (which means that GridTask.map(List, Object) method has finished).

Returns:
true if map step has completed.

waitForMap

boolean waitForMap()
                   throws GridException
Waits until GridTask.map(List, Object) method completes. This may be useful when it is desired to know the list of all job siblings for the task, as list of job siblings gets finalized only after the map step completes.

Note that this method will also return if the task fails.

Throws:
GridException - If got interrupted while waiting or any other failure.
Returns:
true if map step has completed, false otherwise.

waitForMap

boolean waitForMap(long timeout)
                   throws GridException
Waits for a specified timeout in milliseconds for GridTask.map(List, Object) method to complete. This may be useful when it is desired to know the list of all job siblings for the task, as list of job siblings gets finalized only after the map step completes.

Throws:
GridException - If got interrupted while waiting or any other failure.
Parameters:
timeout - Maximum time to wait.
Returns:
true if map step has completed, false otherwise.

waitForMap

boolean waitForMap(long timeout,
                   TimeUnit unit)
                   throws GridException
Waits for a specified timeout in milliseconds for GridTask.map(List, Object) method to complete. This may be useful when it is desired to know the list of all job siblings for the task, as list of job siblings gets finalized only after the map step completes.

Throws:
GridException - If got interrupted while waiting or any other failure.
Parameters:
timeout - Maximum time to wait.
unit - Time unit for time parameter.
Returns:
true if map step has completed, false otherwise.

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube