Package org.jppf.node.event
Class TaskExecutionEvent
java.lang.Object
java.util.EventObject
org.jppf.node.event.TaskExecutionEvent
- All Implemented Interfaces:
Serializable
Instances of this class represent events that occur during the life span of an individual JPPF task.
- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionTaskExecutionEvent(Task<?> task, String jobId, String jobName, long cpuTime, long elapsedTime, boolean error) Initialize this event object with the specified task.TaskExecutionEvent(Task<?> task, String jobId, String jobName, Object userObject, boolean sendViaJmx) Initialize this event object with the specified task. -
Method Summary
Modifier and TypeMethodDescriptionTask<?>getTask()Get the JPPF task from which the event originates.Get the object encapsulating information about the task.Get the user-defined object to send as part of the notification.booleanIftruethen also send this notification via the JMX MBean, otherwise only send to local listeners.booleanDetermine whether this is a task completion or user-sent event.booleanDetermine whether this is a user-sent event.toString()Methods inherited from class java.util.EventObject
getSource
-
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- iftruethen also send this notification via the JMX MBean, otherwise only send to local listeners.- Since:
- 4.0
-
-
Method Details
-
getTask
Get the JPPF task from which the event originates.- Returns:
- a
Taskinstance.
-
getTaskInformation
Get the object encapsulating information about the task.- Returns:
- a
TaskInformationinstance.
-
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()Iftruethen also send this notification via the JMX MBean, otherwise only send to local listeners.- Returns:
trueif this notification should be sent via JMX,falseotherwise.- Since:
- 4.0
-
isTaskCompletion
public boolean isTaskCompletion()Determine whether this is a task completion or user-sent event.- Returns:
trueif this is a task completion event,falseotherwise.- Since:
- 4.0
-
isUserNotification
public boolean isUserNotification()Determine whether this is a user-sent event.- Returns:
trueif this is a task completion event,falseotherwise.- Since:
- 4.1
-
toString
- Overrides:
toStringin classEventObject
-