org.apache.ignite.spi.collision

## Interface CollisionJobContext

-     public interface CollisionJobContext

  This interface defines set of operations that collision SPI implementation can perform on jobs that are either waiting or executing.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `activate()` Activates the job.
    `boolean` | `cancel()` Cancels the job.
    `ComputeJob` | `getJob()` Job for this context.
    `ComputeJobContext` | `getJobContext()` Gets job context.
    `ComputeTaskSession` | `getTaskSession()` Gets current task session associated with this job.

- - ### Method Detail

    - #### getTaskSession

          ComputeTaskSession getTaskSession()

      Gets current task session associated with this job.
      Returns:
        Grid task session.

    - #### getJobContext

          ComputeJobContext getJobContext()

      Gets job context. Use this context to set/get attributes that should be visible only to this job and should not be distributed to other jobs in the grid.

      Job context travels with job whenever it gets failed-over to another node, so attributes set on the context on one node will be visible on other nodes this job may potentially end up on.

      Returns:
        Job context.

    - #### getJob

          ComputeJob getJob()

      Job for this context.
      Returns:
        Job for this context.

    - #### activate

          boolean activate()

      Activates the job. If job is already active this is no-op. Collision resolution is handled concurrently, so it may be possible that other threads already activated or cancelled/rejected this job. This method will return `true` if it was able to activate the job, and `false` otherwise.
      Returns:
        `True` if it was possible to activate the job, and `false` otherwise.

    - #### cancel

          boolean cancel()

      Cancels the job. If job was active (executing) method `ComputeJob.cancel()` will be called on the job. If job was in wait state, then it will be `rejected` prior to execution and `ComputeJob.cancel()` will not be called.

      Collision resolution is handled concurrently, so it may be possible that other threads already activated or cancelled/rejected this job. This method will return `true` if it was able to cancel/reject the job and `false` otherwise.

      Returns:
        `True` if it was possible to cancel/reject this job, `false` otherwise.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020