|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@Apache20LicenseCompatible public interface GridJobContext
Context attached to every job executed on the grid. Note that unlike
GridTaskSession, 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 GridJobResultPolicy.FAILOVER
policy from GridTask.result(GridJobResult, 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 GridJobContext to communicate between SPI's and jobs.
For example, if you need to cancel an actively running job from GridCollisionSpi
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 GridFailoverSpi prior to failing over a job.
From within GridTask.result(GridJobResult, List) or GridTask.reduce(List) methods,
job context is available via GridJobResult.getJobContext() method which gives user the
ability to check context attributes from within grid task implementation for every job
returned from remote nodes.
Job context can be injected into GridJob via @GridJobContextResource
annotation. Refer to the @GridJobContextResource
documentation for coding examples on how to inject job context.
Attribute names that start with "gridgain:" are reserved for internal system use.
See Also:
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0
![]() |
![]() |
| Method Summary | |
|---|---|
Serializable |
getAttribute(Serializable key)
Gets attribute from this job context. |
Map<? extends Serializable,? extends Serializable> |
getAttributes()
Gets all attributes present in this job context. |
UUID |
getJobId()
Gets ID of the job this context belongs to. |
void |
setAttribute(Serializable key,
Serializable val)
Sets an attribute into this job context. |
void |
setAttributes(Map<? extends Serializable,? extends Serializable> attrs)
Sets map of attributes into this job context. |
| Method Detail |
|---|
UUID getJobId()
void setAttribute(Serializable key,
@Nullable
Serializable val)
key - Attribute key.val - Attribute value.void setAttributes(Map<? extends Serializable,? extends Serializable> attrs)
attrs - Local attributes.Serializable getAttribute(Serializable key)
key - Attribute key.
Map<? extends Serializable,? extends Serializable> getAttributes()
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|