Interface ComputeJobResult
-
public interface ComputeJobResultResult of remote job which gets passed intoComputeTask.result(ComputeJobResult, List)method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetData()Gets data returned by remote job if it didn't fail.IgniteExceptiongetException()Gets exception produced by execution of remote job, ornullif remote execution finished normally and did not produce any exceptions.<T extends ComputeJob>
TgetJob()Gets local instance of remote job returned byComputeTask.map(List, Object)method.ComputeJobContextgetJobContext()Gets job context.ClusterNodegetNode()Gets node this job executed on.booleanisCancelled()Gets job cancellation status.
-
-
-
Method Detail
-
getJobContext
ComputeJobContext getJobContext()
Gets job context. Use job context to access job unique ID or to get/set jobs attributes. Context is attached to a job and travels with it wherever it goes. For example, if a job gets failed-over from one node to another, then its context will be failed over with it and all attributes that were set on the job on the first node will be available on the new node.- Returns:
- Job context.
-
getData
<T> T getData()
Gets data returned by remote job if it didn't fail. This data is the object returned fromComputeJob.execute()method.Note that if task is annotated with
ComputeTaskNoResultCacheannotation, then job results will not be cached and will be available only inComputeTask.result(ComputeJobResult, List)method for every individual job, but not inComputeTask.reduce(List)method. This feature was added to avoid excessive storing of overly large results.- Type Parameters:
T- Type of the return value returning fromComputeJob.execute()method.- Returns:
- Data returned by remote job's
ComputeJob.execute()method if it didn't fail.
-
getException
IgniteException getException()
Gets exception produced by execution of remote job, ornullif remote execution finished normally and did not produce any exceptions.- Returns:
IgniteExceptionproduced by execution of remote job ornullif no exception was produced.Note that if remote job resulted in
RuntimeExceptionorErrorthen they will be wrapped intoComputeUserUndeclaredExceptionreturned by this method.If job on remote node was rejected (cancelled while it was on waiting queue), then
ComputeExecutionRejectedExceptionwill be returned.If node on which job was computing failed, then
ClusterTopologyExceptionis returned.
-
getJob
<T extends ComputeJob> T getJob()
Gets local instance of remote job returned byComputeTask.map(List, Object)method.- Type Parameters:
T- Type ofComputeJobthat was sent to remote node.- Returns:
- Local instance of remote job returned by
ComputeTask.map(List, Object)method.
-
getNode
ClusterNode getNode()
Gets node this job executed on.- Returns:
- Node this job executed on.
-
isCancelled
boolean isCancelled()
Gets job cancellation status. Returnstrueif job received cancellation request on remote node. Note that job, after receiving cancellation request, will still need to finish and return, hencegetData()method may contain execution result even if the job was canceled.Job can receive cancellation request if the task was explicitly cancelled from future (see
IgniteFuture.cancel()) or if task completed prior to getting results from all remote jobs.- Returns:
trueif job received cancellation request andfalseotherwise.
-
-