FileDocCategorySizeDatePackage
WorkEvent.javaAPI DocGlassfish v2 API5483Fri May 04 22:35:38 BST 2007javax.resource.spi.work

WorkEvent

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

Fields Summary
public static final int
WORK_ACCEPTED
Indicates Work instance has been accepted.
public static final int
WORK_REJECTED
Indicates Work instance has been rejected.
public static final int
WORK_STARTED
Indicates Work instance has started execution.
public static final int
WORK_COMPLETED
Indicates Work instance has completed execution.
private int
type
The event type.
private Work
work
The Work object on which the event occured.
private WorkException
exc
The exception that occured during Work processing.
private long
startDuration
The start delay duration (in milliseconds).
Constructors Summary
public WorkEvent(Object source, int type, Work work, WorkException exc)
Constructor.

param
source The object on which the event initially occurred.
param
type The event type.
param
work The Work object on which the event occured.
param
exc The exception that occured during Work processing.


                                              
             
	super(source);
	this.type = type;
	this.work =  work;
	this.exc = exc;
    
public WorkEvent(Object source, int type, Work work, WorkException exc, long startDuration)
Constructor.

param
source The object on which the event initially occurred.
param
type The event type.
param
work The Work object on which the event occured.
param
exc The exception that occured during Work processing.
param
startDuration The start delay duration (in milliseconds).

	this(source, type, work, exc);
	this.startDuration = startDuration;
    
Methods Summary
public WorkExceptiongetException()
Return the WorkException. The actual WorkException subtype returned depends on the type of the event.

return
a WorkRejectedException or a WorkCompletedException, if any.

 return this.exc; 
public longgetStartDuration()
Return the start interval duration.

return
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.

 return this.startDuration; 
public intgetType()
Return the type of this event.

return
the event type.

 return this.type; 
public WorkgetWork()
Return the Work instance which is the cause of the event.

return
the Work instance.

 return this.work;