Package org.apache.ignite.events

## Class JobEvent

- java.lang.Object
- - org.apache.ignite.events.EventAdapter
  - - org.apache.ignite.events.JobEvent

- All Implemented Interfaces:
    `Serializable`, `Comparable<Event>`, `Event`

      public class JobEvent
      extends EventAdapter

  Grid job event.

  Grid events are used for notification about what happens within the grid. Note that by design Ignite keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:

  - `IgniteEvents.remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)` - asynchronously querying events occurred on the nodes specified, including remote nodes.
  - `IgniteEvents.localQuery(org.apache.ignite.lang.IgnitePredicate, int...)` - querying only local events stored on this local node.
  - `IgniteEvents.localListen(org.apache.ignite.lang.IgnitePredicate, int...)` - listening to local grid events (events from remote nodes not included).
  User can also wait for events using method `IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)`.

  # Events and Performance

  Note that by default all events in Ignite are enabled and therefore generated and stored by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds under the load and therefore it creates a significant additional load on the system. If these events are not needed by the application this load is unnecessary and leads to significant performance degradation.

  It is highly recommended to enable only those events that your application logic requires by using `IgniteConfiguration.getIncludeEventTypes()` method in Ignite configuration. Note that certain events are required for Ignite's internal operations and such events will still be generated but not stored by event storage SPI if they are disabled in Ignite configuration.

  See Also:
    `EventType.EVT_JOB_CANCELLED`, `EventType.EVT_JOB_FAILED`, `EventType.EVT_JOB_FAILED_OVER`, `EventType.EVT_JOB_FINISHED`, `EventType.EVT_JOB_MAPPED`, `EventType.EVT_JOB_QUEUED`, `EventType.EVT_JOB_REJECTED`, `EventType.EVT_JOB_RESULTED`, `EventType.EVT_JOB_STARTED`, `EventType.EVT_JOB_TIMEDOUT`, `EventType.EVTS_JOB_EXECUTION`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JobEvent()` | No-arg constructor.
    `JobEvent​(ClusterNode node, String msg, int type)` | Creates job event with given parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `IgniteUuid` | `jobId()` | Gets job ID.
    `void` | `jobId​(IgniteUuid jobId)` | Sets job ID.
    `@Nullable ComputeJobResultPolicy` | `resultPolicy()` | Gets job result policy.
    `void` | `resultPolicy​(@Nullable ComputeJobResultPolicy resPlc)` | Sets job result policy.
    `String` | `shortDisplay()` | Gets a shortened version of `toString()` result.
    `String` | `taskClassName()` | Gets name of task class that triggered this event.
    `void` | `taskClassName​(String taskClsName)` | Sets name of the task class that triggered this event.
    `String` | `taskName()` | Gets name of the task that triggered the event.
    `void` | `taskName​(String taskName)` | Sets name of the task that triggered this event.
    `ClusterNode` | `taskNode()` | Get node where parent task of the job has originated.
    `void` | `taskNode​(ClusterNode taskNode)` | Sets node where parent task of the job has originated.
    `IgniteUuid` | `taskSessionId()` | Gets task session ID of the task that triggered this event.
    `void` | `taskSessionId​(IgniteUuid sesId)` | Sets task session ID of the task that triggered this event.
    `UUID` | `taskSubjectId()` | Gets task subject ID.
    `void` | `taskSubjectId​(UUID taskSubjId)` | Sets task subject ID.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.events.EventAdapter

      `compareTo, equals, hashCode, id, localOrder, message, message, name, node, node, timestamp, type, type`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### JobEvent

          public JobEvent()

      No-arg constructor.

    - #### JobEvent

          public JobEvent​(ClusterNode node,
                          String msg,
                          int type)

      Creates job event with given parameters.
      Parameters:
        `node` - Node.
        `msg` - Optional message.
        `type` - Event type.

  - ### Method Detail

    - #### shortDisplay

          public String shortDisplay()

      Gets a shortened version of `toString()` result. Suitable for humans to read.
      Specified by:
        `shortDisplay` in interface `Event`
      Overrides:
        `shortDisplay` in class `EventAdapter`
      Returns:
        Shortened version of `toString()` result.

    - #### taskName

          public String taskName()

      Gets name of the task that triggered the event.
      Returns:
        Name of the task that triggered the event.

    - #### taskClassName

          public String taskClassName()

      Gets name of task class that triggered this event.
      Returns:
        Name of task class that triggered the event.

    - #### taskSessionId

          public IgniteUuid taskSessionId()

      Gets task session ID of the task that triggered this event.
      Returns:
        Task session ID of the task that triggered the event.

    - #### jobId

          public IgniteUuid jobId()

      Gets job ID.
      Returns:
        Job ID.

    - #### taskName

          public void taskName​(String taskName)

      Sets name of the task that triggered this event.
      Parameters:
        `taskName` - Task name to set.

    - #### taskClassName

          public void taskClassName​(String taskClsName)

      Sets name of the task class that triggered this event.
      Parameters:
        `taskClsName` - Task class name to set.

    - #### taskSessionId

          public void taskSessionId​(IgniteUuid sesId)

      Sets task session ID of the task that triggered this event.
      Parameters:
        `sesId` - Task session ID to set.

    - #### jobId

          public void jobId​(IgniteUuid jobId)

      Sets job ID.
      Parameters:
        `jobId` - Job ID to set.

    - #### taskNode

          public ClusterNode taskNode()

      Get node where parent task of the job has originated.
      Returns:
        Node where parent task of the job has originated.

    - #### taskNode

          public void taskNode​(ClusterNode taskNode)

      Sets node where parent task of the job has originated.
      Parameters:
        `taskNode` - Node where parent task of the job has originated.

    - #### taskSubjectId

          public UUID taskSubjectId()

      Gets task subject ID.
      Returns:
        Task subject ID.

    - #### taskSubjectId

          public void taskSubjectId​(UUID taskSubjId)

      Sets task subject ID.
      Parameters:
        `taskSubjId` - Task subject ID.

    - #### resultPolicy

          @Nullable
          public @Nullable ComputeJobResultPolicy resultPolicy()

      Gets job result policy. Not null for `EventType.EVT_JOB_RESULTED` and `EventType.EVT_JOB_FAILED_OVER` event types.
      Returns:
        Result policy.

    - #### resultPolicy

          public void resultPolicy​(@Nullable
                                   @Nullable ComputeJobResultPolicy resPlc)

      Sets job result policy.
      Parameters:
        `resPlc` - New result policy.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventAdapter`