public interface ComputeJobContext extends ComputeJobContinuation
ComputeTaskSession, which distributes all attributes to all jobs in the task including the task itself, job context attributes belong to a job and do not get sent over network unless a job moves from one node to another.
In most cases a job, once assigned to a node, will never move to another
node. However, it is possible that collision SPI rejects a job before
it ever got a chance to execute (job rejection) which will cause fail-over
to another node. Or user is not satisfied with the outcome of a job and
fails it over to another node by returning
ComputeTask.result(ComputeJobResult, List) method. In this case
all context attributes set on one node will be available on any other node
this job travels to.
You can also use
ComputeJobContext to communicate between SPI's and jobs.
For example, if you need to cancel an actively running job from
you may choose to set some context attribute on the job to mark the fact
that a job was cancelled by grid and not by a user. Context attributes can
also be assigned in
FailoverSpi prior to failing over a job.
ComputeTask.result(ComputeJobResult, List) or
job context is available via
ComputeJobResult.getJobContext() method which gives user the
ability to check context attributes from within grid task implementation for every job
returned from remote nodes.
Attribute names that start with
"apache.ignite:" are reserved for internal system use.
|Modifier and Type||Method and Description|
Gets attribute from this job context.
Gets all attributes present in this job context.
Gets ID of the job this context belongs to.
Sets an attribute into this job context.
Sets map of attributes into this job context.
key- Attribute key.
val- Attribute value.
void setAttributes(Map<?,?> attrs)
attrs- Local attributes.
<K,V> V getAttribute(K key)
K- Type of the attribute key.
V- Type of the attribute value.
key- Attribute key.