public class GridJobResultImpl extends Object implements ComputeJobResult
Constructor and Description |
---|
GridJobResultImpl(ComputeJob job,
IgniteUuid jobId,
ClusterNode node,
GridJobSiblingImpl sib) |
Modifier and Type | Method and Description |
---|---|
void |
clearData()
Clears stored job data.
|
Object |
getData()
Gets data returned by remote job if it didn't fail.
|
IgniteException |
getException()
Gets exception produced by execution of remote job, or
null if
remote execution finished normally and did not produce any exceptions. |
ComputeJob |
getJob()
Gets local instance of remote job returned by
ComputeTask.map(List, Object) method. |
ComputeJobContext |
getJobContext()
Gets job context.
|
ClusterNode |
getNode()
Gets node this job executed on.
|
GridJobSiblingImpl |
getSibling() |
boolean |
hasResponse() |
boolean |
isCancelled()
Gets job cancellation status.
|
boolean |
isOccupied() |
void |
onResponse(Object data,
IgniteException ex,
Map<Object,Object> jobAttrs,
boolean isCancelled) |
void |
resetResponse() |
void |
setNode(ClusterNode node) |
void |
setOccupied(boolean isOccupied) |
String |
toString() |
public GridJobResultImpl(ComputeJob job, IgniteUuid jobId, ClusterNode node, GridJobSiblingImpl sib)
job
- Job instance.jobId
- ID of the job.node
- Node from where this result was received.sib
- Sibling associated with this result.public ComputeJob getJob()
ComputeTask.map(List, Object)
method.getJob
in interface ComputeJobResult
ComputeTask.map(List, Object)
method.public ComputeJobContext getJobContext()
getJobContext
in interface ComputeJobResult
public GridJobSiblingImpl getSibling()
public ClusterNode getNode()
getNode
in interface ComputeJobResult
public Object getData()
ComputeJob.execute()
method.
Note that if task is annotated with ComputeTaskNoResultCache
annotation,
then job results will not be cached and will be available only in
ComputeTask.result(ComputeJobResult, List)
method for every individual job,
but not in ComputeTask.reduce(List)
method. This feature was added to
avoid excessive storing of overly large results.
getData
in interface ComputeJobResult
ComputeJob.execute()
method if it didn't fail.public IgniteException getException()
null
if
remote execution finished normally and did not produce any exceptions.getException
in interface ComputeJobResult
IgniteException
produced by execution of remote job or null
if
no exception was produced.
Note that if remote job resulted in RuntimeException
or Error
then they will be wrapped into ComputeUserUndeclaredException
returned by this method.
If job on remote node was rejected (cancelled while it was on waiting queue), then
ComputeExecutionRejectedException
will be returned.
If node on which job was computing failed, then ClusterTopologyException
is
returned.
public boolean isCancelled()
true
if job received cancellation
request on remote node. Note that job, after receiving cancellation request, will still
need to finish and return, hence ComputeJobResult.getData()
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.
isCancelled
in interface ComputeJobResult
true
if job received cancellation request and false
otherwise.public void setNode(ClusterNode node)
node
- Node from where this result was received.public void onResponse(@Nullable Object data, @Nullable IgniteException ex, @Nullable Map<Object,Object> jobAttrs, boolean isCancelled)
data
- Job data.ex
- Job exception.jobAttrs
- Job attributes.isCancelled
- Whether job was cancelled or not.public void setOccupied(boolean isOccupied)
isOccupied
- True
if job for this response is being sent.public boolean isOccupied()
True
if job for this response is being sent.public void clearData()
public void resetResponse()
public boolean hasResponse()
true
if remote job responded.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017