Package javax.resource.spi.work
Class WorkEvent
- java.lang.Object
-
- java.util.EventObject
-
- javax.resource.spi.work.WorkEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class WorkEvent extends java.util.EventObjectThis class models the various events that occur during the processing of aWorkinstance.- Version:
- 1.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static intDURATION_IDXprivate WorkExceptioneThe exception that occured duringWorkprocessing.private static intEXCPEPTION_IDXprivate static java.io.ObjectStreamField[]serialPersistentFieldsPersistence fields informationprivate static longserialVersionUIDSerial version uidprivate longstartDurationThe start delay duration (in milliseconds).private inttypeThe event type.private static intTYPE_IDXprivate WorkworkTheWorkobject on which the event occured.static intWORK_ACCEPTEDIndicatesWorkinstance has been accepted.static intWORK_COMPLETEDIndicatesWorkinstance has completed execution.private static intWORK_IDXstatic intWORK_REJECTEDIndicatesWorkinstance has been rejected.static intWORK_STARTEDIndicatesWorkinstance has started execution.
-
Constructor Summary
Constructors Constructor Description WorkEvent(java.lang.Object source, int type, Work work, WorkException exc)Constructor.WorkEvent(java.lang.Object source, int type, Work work, WorkException exc, long startDuration)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkExceptiongetException()Return theWorkException.longgetStartDuration()Return the start interval duration.intgetType()Return the type of this event.WorkgetWork()Return theWorkinstance which is the cause of the event.private voidreadObject(java.io.ObjectInputStream ois)Read objectprivate voidwriteObject(java.io.ObjectOutputStream oos)Write object
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version uid
-
serialPersistentFields
private static final java.io.ObjectStreamField[] serialPersistentFields
Persistence fields information
-
TYPE_IDX
private static final int TYPE_IDX
- See Also:
- Constant Field Values
-
WORK_IDX
private static final int WORK_IDX
- See Also:
- Constant Field Values
-
EXCPEPTION_IDX
private static final int EXCPEPTION_IDX
- See Also:
- Constant Field Values
-
DURATION_IDX
private static final int DURATION_IDX
- See Also:
- Constant Field Values
-
WORK_ACCEPTED
public static final int WORK_ACCEPTED
IndicatesWorkinstance has been accepted.- See Also:
- Constant Field Values
-
WORK_REJECTED
public static final int WORK_REJECTED
IndicatesWorkinstance has been rejected.- See Also:
- Constant Field Values
-
WORK_STARTED
public static final int WORK_STARTED
IndicatesWorkinstance has started execution.- See Also:
- Constant Field Values
-
WORK_COMPLETED
public static final int WORK_COMPLETED
IndicatesWorkinstance has completed execution.- See Also:
- Constant Field Values
-
type
private int type
The event type.
-
work
private Work work
TheWorkobject on which the event occured.
-
e
private WorkException e
The exception that occured duringWorkprocessing.
-
startDuration
private long startDuration
The start delay duration (in milliseconds).
-
-
Constructor Detail
-
WorkEvent
public WorkEvent(java.lang.Object source, int type, Work work, WorkException exc)Constructor.- Parameters:
source- The object on which the event initially occurred.type- The event type.work- TheWorkobject on which the event occured.exc- The exception that occured duringWorkprocessing.
-
WorkEvent
public WorkEvent(java.lang.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- TheWorkobject on which the event occured.exc- The exception that occured duringWorkprocessing.startDuration- The start delay duration (in milliseconds).
-
-
Method Detail
-
getType
public int getType()
Return the type of this event.- Returns:
- the event type.
-
getWork
public Work getWork()
Return theWorkinstance which is the cause of the event.- Returns:
- the
Workinstance.
-
getStartDuration
public long getStartDuration()
Return the start interval duration.- Returns:
- the time elapsed (in milliseconds) since the
Workwas accepted, until theWorkexecution started. Note, this does not offer real-time guarantees. It is valid to return -1, if the actual start interval duration is unknown.
-
getException
public WorkException getException()
Return theWorkException. The actualWorkExceptionsubtype returned depends on the type of the event.- Returns:
- a
WorkRejectedExceptionor aWorkCompletedException, if any.
-
readObject
private void readObject(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOExceptionRead object- Parameters:
ois- The object input stream- Throws:
java.lang.ClassNotFoundException- If a class can not be foundjava.io.IOException- Thrown if an error occurs
-
writeObject
private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOExceptionWrite object- Parameters:
oos- The object output stream- Throws:
java.io.IOException- Thrown if an error occurs
-
-