public class GridJobResultImpl extends Object implements GridComputeJobResult
| Constructor and Description |
|---|
GridJobResultImpl(GridComputeJob job,
GridUuid jobId,
GridNode 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.
|
GridException |
getException()
Gets exception produced by execution of remote job, or
null if
remote execution finished normally and did not produce any exceptions. |
GridComputeJob |
getJob()
Gets local instance of remote job returned by
GridComputeTask.map(List, Object) method. |
GridComputeJobContext |
getJobContext()
Gets job context.
|
GridNode |
getNode()
Gets node this job executed on.
|
GridJobSiblingImpl |
getSibling() |
boolean |
hasResponse() |
boolean |
isCancelled()
Gets job cancellation status.
|
boolean |
isOccupied() |
void |
onResponse(Object data,
GridException ex,
Map<Object,Object> jobAttrs,
boolean isCancelled) |
void |
resetResponse() |
void |
setNode(GridNode node) |
void |
setOccupied(boolean isOccupied) |
String |
toString() |
public GridJobResultImpl(GridComputeJob job, GridUuid jobId, GridNode 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 GridComputeJob getJob()
GridComputeTask.map(List, Object) method.getJob in interface GridComputeJobResultGridComputeTask.map(List, Object) method.public GridComputeJobContext getJobContext()
getJobContext in interface GridComputeJobResultpublic GridJobSiblingImpl getSibling()
public GridNode getNode()
getNode in interface GridComputeJobResultpublic Object getData()
GridComputeJob.execute() method.
Note that if task is annotated with GridComputeTaskNoResultCache annotation,
then job results will not be cached and will be available only in
GridComputeTask.result(GridComputeJobResult, List) method for every individual job,
but not in GridComputeTask.reduce(List) method. This feature was added to
avoid excessive storing of overly large results.
getData in interface GridComputeJobResultGridComputeJob.execute() method if it didn't fail.public GridException getException()
null if
remote execution finished normally and did not produce any exceptions.getException in interface GridComputeJobResultGridException 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 GridComputeUserUndeclaredException
returned by this method.
If job on remote node was rejected (cancelled while it was on waiting queue), then
GridComputeExecutionRejectedException will be returned.
If node on which job was computing failed, then GridTopologyException 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 GridComputeJobResult.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 GridFuture.cancel()) or if task completed prior
to getting results from all remote jobs.
isCancelled in interface GridComputeJobResulttrue if job received cancellation request and false otherwise.public void setNode(GridNode node)
node - Node from where this result was received.public void onResponse(@Nullable Object data, @Nullable GridException 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.Copyright © 2014. All rights reserved.