Class TaskExecutionEvent

java.lang.Object
java.util.EventObject
org.jppf.node.event.TaskExecutionEvent
All Implemented Interfaces:
Serializable

public class TaskExecutionEvent extends EventObject
Instances of this class represent events that occur during the life span of an individual JPPF task.
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • TaskExecutionEvent

      public TaskExecutionEvent(Task<?> task, String jobId, String jobName, long cpuTime, long elapsedTime, boolean error)
      Initialize this event object with the specified task. This constructor is used by the JPPF node when sending task completion notifications.
      Parameters:
      task - the JPPF task from which the event originates.
      jobId - the id of the job this task belongs to.
      jobName - the name of the job this task belongs to.
      cpuTime - the cpu time taken by the task.
      elapsedTime - the wall clock time taken by the task.
      error - determines whether the task had an exception.
    • TaskExecutionEvent

      public TaskExecutionEvent(Task<?> task, String jobId, String jobName, Object userObject, boolean sendViaJmx)
      Initialize this event object with the specified task. This constructor is used when sending user-ddefined notifications from the tasks.
      Parameters:
      task - the JPPF task from which the event originates.
      jobId - the id of the job this task belongs to.
      jobName - the name of the job this task belongs to.
      userObject - a user-defined object to send as part of the notification.
      sendViaJmx - if true then also send this notification via the JMX MBean, otherwise only send to local listeners.
      Since:
      4.0
  • Method Details

    • getTask

      public Task<?> getTask()
      Get the JPPF task from which the event originates.
      Returns:
      a Task instance.
    • getTaskInformation

      public TaskInformation getTaskInformation()
      Get the object encapsulating information about the task.
      Returns:
      a TaskInformation instance.
    • getUserObject

      public Object getUserObject()
      Get the user-defined object to send as part of the notification.
      Returns:
      the object specified in the constructor or null.
      Since:
      4.0
    • isSendViaJmx

      public boolean isSendViaJmx()
      If true then also send this notification via the JMX MBean, otherwise only send to local listeners.
      Returns:
      true if this notification should be sent via JMX, false otherwise.
      Since:
      4.0
    • isTaskCompletion

      public boolean isTaskCompletion()
      Determine whether this is a task completion or user-sent event.
      Returns:
      true if this is a task completion event, false otherwise.
      Since:
      4.0
    • isUserNotification

      public boolean isUserNotification()
      Determine whether this is a user-sent event.
      Returns:
      true if this is a task completion event, false otherwise.
      Since:
      4.1
    • toString

      public String toString()
      Overrides:
      toString in class EventObject