public interface ComputeJob extends Serializable
ComputeTask. Grid task gets split into jobs when
ComputeTask.map(List, Object)method is called. This method returns all jobs for the task mapped to their corresponding grid nodes for execution. Grid will then serialize this jobs and send them to requested nodes for execution. When a node receives a request to execute a job, the following sequence of events takes place:
CollisionSpiSPI. Otherwise job will be submitted to the executor service responsible for job execution immediately upon arrival.
ComputeTask.result(ComputeJobResult, List)method will contain
ComputeExecutionRejectedExceptionexception. If you are using any of the task adapters shipped with Ignite, then job will be failed over automatically for execution on another node.
ComputeTaskSession) will be injected.
cancel()method will be called. Note that just like with
Thread.interrupt()method, grid job cancellation serves as a hint that a job should stop executing or exhibit some other user defined behavior. Generally it is up to a job to decide whether it wants to react to cancellation or ignore it. Job cancellation can happen for several reasons:
ComputeTask.result(ComputeJobResult, List)method via
ComputeJobResultinstance. If job execution resulted in a checked exception, then
ComputeJobResult.getException()method will contain that exception. If job execution threw a runtime exception or error, then it will be wrapped into
ComputeJobAdapteradapter that provides default empty implementation for
cancel()method and also allows user to set and get job argument, if there is one.
ComputeTaskSession). Other jobs can wait for an attribute to be set either synchronously or asynchronously. Such functionality allows jobs to synchronize their execution with other jobs at any point and can be useful when other jobs within task need to be made aware of certain event or state change that occurred during job execution.
Distributed task session can be injected into
Both, field and method based injections are supported. Refer to
ComputeTaskSession documentation for more information on session functionality.
ComputeTaskSession.saveCheckpoint(String, Object, ComputeTaskSessionScope, long)
non-nullvalue is returned, then job can continue from where it failed last time, otherwise it would start from scratch. Throughout it's execution job should periodically save its intermediate state to avoid starting from scratch in case of a failure.
Note that job cancellation is only a hint, and just like with
Thread.interrupt() method, it is really up to the actual job
instance to gracefully finish execution and exit.
@Nullable Object execute() throws IgniteException
null). This result will be returned in
ComputeJobResult.getData()method passed into
ComputeTask.result(ComputeJobResult, List)task method on caller node.
IgniteException- If job execution caused an exception. This exception will be returned in
ComputeJobResult.getException()method passed into
ComputeTask.result(ComputeJobResult, List)task method on caller node. If execution produces a
Error, then it will be wrapped into