BEA Systems, Inc.

commonj.work
Interface WorkItem

All Superinterfaces:
Comparable
All Known Subinterfaces:
RemoteWorkItem

public interface WorkItem
extends Comparable

This is returned once a Work is submitted to a WorkManager. It can be used to check the status of Work after it's finished and to check any exceptions that it threw. If the Work was serializable and the vendor implementation supports distributed WorkManagers then this object can be cast to RemoteWorkItem where additional APIs are defined to exploit this capability. WorkItem instances can also be used with the WorkManager.waitForAny(java.util.Collection, long) or WorkManager.waitForAll(java.util.Collection, long) to wait for remote or local WorkItems to complete.

Applications can use the WorkItem as a key to correlate the WorkItem back to the running Work object. The WorkItem should implement the equals, compareTo and hashCode methods and is therefore Collection-friendly.

Since:
1.0
See Also:
WorkManager, RemoteWorkItem, WorkListener

Method Summary
 Work getResult()
          This returns the Work once it has completed.
 int getStatus()
          This returns the current status of dispatching the Work.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getResult

Work getResult()
               throws WorkException
This returns the Work once it has completed. If the Work threw an exception during run then the exception is rethrown here.

Returns:
the completed Work or null if the Work is not yet complete.
Throws:
WorkException
Since:
1.1

getStatus

int getStatus()
This returns the current status of dispatching the Work. See WorkEvent for the values.

Returns:
one of the events specified on the WorkEvent interface.
Since:
1.0
See Also:
WorkEvent

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs100
Copyright 2006 BEA Systems Inc.