Class WorkEvent

java.lang.Object
java.util.EventObject
jakarta.resource.spi.work.WorkEvent
All Implemented Interfaces:
Serializable

public class WorkEvent extends EventObject
This class models the various events that occur during the processing of a Work instance.
Version:
1.0
Author:
Ram Jeyaraman
See Also:
  • Field Details Link icon

    • WORK_ACCEPTED Link icon

      public static final int WORK_ACCEPTED
      Indicates Work instance has been accepted.
      See Also:
    • WORK_REJECTED Link icon

      public static final int WORK_REJECTED
      Indicates Work instance has been rejected.
      See Also:
    • WORK_STARTED Link icon

      public static final int WORK_STARTED
      Indicates Work instance has started execution.
      See Also:
    • WORK_COMPLETED Link icon

      public static final int WORK_COMPLETED
      Indicates Work instance has completed execution.
      See Also:
  • Constructor Details Link icon

    • WorkEvent Link icon

      public WorkEvent(Object source, int type, Work work, WorkException exc)
      Constructor.
      Parameters:
      source - The object on which the event initially occurred.
      type - The event type.
      work - The Work object on which the event occured.
      exc - The exception that occured during Work processing.
    • WorkEvent Link icon

      public WorkEvent(Object source, int type, Work work, WorkException exc, long startDuration)
      Constructor.
      Parameters:
      source - The object on which the event initially occurred.
      type - The event type.
      work - The Work object on which the event occured.
      exc - The exception that occured during Work processing.
      startDuration - The start delay duration (in milliseconds).
  • Method Details Link icon

    • getType Link icon

      public int getType()
      Return the type of this event.
      Returns:
      the event type.
    • getWork Link icon

      public Work getWork()
      Return the Work instance which is the cause of the event.
      Returns:
      the Work instance.
    • getStartDuration Link icon

      public long getStartDuration()
      Return the start interval duration.
      Returns:
      the time elapsed (in milliseconds) since the Work was accepted, until the Work execution started. Note, this does not offer real-time guarantees. It is valid to return -1, if the actual start interval duration is unknown.
    • getException Link icon

      public WorkException getException()
      Return the WorkException. The actual WorkException subtype returned depends on the type of the event.
      Returns:
      a WorkRejectedException or a WorkCompletedException, if any.