Top Description Fields Constructors Methods
javax.resource.spi.work

public Class WorkEvent

extends EventObject
Class Inheritance
Imports
java.lang.Object, .Runnable, .Exception, .Throwable, java.util.EventObject

This class models the various events that occur during the processing of a Work instance.
Author
Ram Jeyaraman
Version
1.0

Field Summary

Modifier and TypeField and Description
private WorkException
exc

The exception that occured during Work processing.

private long
startDuration

The start delay duration (in milliseconds).

private int
type

The event type.

private Work
work

The Work object on which the event occured.

public static final int
WORK_ACCEPTED

Indicates Work instance has been accepted.

public static final int
WORK_COMPLETED

Indicates Work instance has completed execution.

public static final int
WORK_REJECTED

Indicates Work instance has been rejected.

public static final int
WORK_STARTED

Indicates Work instance has started execution.

Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
WorkEvent(Object
The object on which the event initially occurred.
source
,
int
The event type.
type
,
Work
The Work object on which the event occured.
work
,
WorkException
The exception that occured during Work processing.
exc
)

Constructor.

public
WorkEvent(Object
The object on which the event initially occurred.
source
,
int
The event type.
type
,
Work
The Work object on which the event occured.
work
,
WorkException
The exception that occured during Work processing.
exc
,
long
The start delay duration (in milliseconds).
startDuration
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public WorkException

Returns:

a WorkRejectedException or a WorkCompletedException, if any.
getException
()

Return the WorkException.

public long

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.
getStartDuration
()

Return the start interval duration.

public int

Returns:

the event type.
getType
()

Return the type of this event.

public Work

Returns:

the Work instance.
getWork
()

Return the Work instance which is the cause of the event.

Inherited from java.util.EventObject:
getSourcetoString

Field Detail

excback to summary
private WorkException exc

The exception that occured during Work processing.

startDurationback to summary
private long startDuration

The start delay duration (in milliseconds).

typeback to summary
private int type

The event type.

workback to summary
private Work work

The Work object on which the event occured.

WORK_ACCEPTEDback to summary
public static final int WORK_ACCEPTED

Indicates Work instance has been accepted.

WORK_COMPLETEDback to summary
public static final int WORK_COMPLETED

Indicates Work instance has completed execution.

WORK_REJECTEDback to summary
public static final int WORK_REJECTED

Indicates Work instance has been rejected.

WORK_STARTEDback to summary
public static final int WORK_STARTED

Indicates Work instance has started execution.

Constructor Detail

WorkEventback to summary
public WorkEvent(Object source, int type, Work work, WorkException exc)

Constructor.

Parameters
source:Object

The object on which the event initially occurred.

type:int

The event type.

work:Work

The Work object on which the event occured.

exc:WorkException

The exception that occured during Work processing.

WorkEventback to summary
public WorkEvent(Object source, int type, Work work, WorkException exc, long startDuration)

Constructor.

Parameters
source:Object

The object on which the event initially occurred.

type:int

The event type.

work:Work

The Work object on which the event occured.

exc:WorkException

The exception that occured during Work processing.

startDuration:long

The start delay duration (in milliseconds).

Method Detail

getExceptionback to summary
public WorkException getException()

Return the WorkException. The actual WorkException subtype returned depends on the type of the event.

Returns:WorkException

a WorkRejectedException or a WorkCompletedException, if any.

getStartDurationback to summary
public long getStartDuration()

Return the start interval duration.

Returns:long

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.

getTypeback to summary
public int getType()

Return the type of this event.

Returns:int

the event type.

getWorkback to summary
public Work getWork()

Return the Work instance which is the cause of the event.

Returns:Work

the Work instance.