java.lang.Object
java.util.EventObject
jakarta.resource.spi.work.WorkEvent
- All Implemented Interfaces:
Serializable
This class models the various events that occur during the processing of
a
Work
instance.- Version:
- 1.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
IndicatesWork
instance has been accepted.static final int
IndicatesWork
instance has completed execution.static final int
IndicatesWork
instance has been rejected.static final int
IndicatesWork
instance has started execution.Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionWorkEvent
(Object source, int type, Work work, WorkException exc) Constructor.WorkEvent
(Object source, int type, Work work, WorkException exc, long startDuration) Constructor. -
Method Summary
Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
WORK_ACCEPTED
public static final int WORK_ACCEPTEDIndicatesWork
instance has been accepted.- See Also:
-
WORK_REJECTED
public static final int WORK_REJECTEDIndicatesWork
instance has been rejected.- See Also:
-
WORK_STARTED
public static final int WORK_STARTEDIndicatesWork
instance has started execution.- See Also:
-
WORK_COMPLETED
public static final int WORK_COMPLETEDIndicatesWork
instance has completed execution.- See Also:
-
-
Constructor Details
-
WorkEvent
Constructor.- Parameters:
source
- The object on which the event initially occurred.type
- The event type.work
- TheWork
object on which the event occured.exc
- The exception that occured duringWork
processing.
-
WorkEvent
Constructor.- Parameters:
source
- The object on which the event initially occurred.type
- The event type.work
- TheWork
object on which the event occured.exc
- The exception that occured duringWork
processing.startDuration
- The start delay duration (in milliseconds).
-
-
Method Details
-
getType
public int getType()Return the type of this event.- Returns:
- the event type.
-
getWork
Return theWork
instance which is the cause of the event.- Returns:
- the
Work
instance.
-
getStartDuration
public long getStartDuration()Return the start interval duration.- Returns:
- the time elapsed (in milliseconds) since the
Work
was accepted, until theWork
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
Return theWorkException
. The actualWorkException
subtype returned depends on the type of the event.- Returns:
- a
WorkRejectedException
or aWorkCompletedException
, if any.
-