|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A job that can be run asynchronously.
The job should implement run() to actually perform the task in the current thread, and interrupt() to interrupt the currently running job. Each AsyncJob object can be run multiple times in sequence, but may not be used multiple times simultaneously; thus, it is well-defined which job the interrupt() method should interrupt.
AsyncJob also contains a PropertySet, which is used to provide meta-information to a job runner; for instance, whether the job may be canceled.
Most AsyncJobs can extend AbstractAsyncJob. Another likely use of AsyncJob is to create a proxy AsyncJob wrapping a remote method call.
Field Summary | |
static ClassConstrainedKey |
CAN_CANCEL_PROPERTY
Key for well-known "can cancel" property. |
static ClassConstrainedKey |
COMPLETED_PROGRESS_STRING_PROPERTY
Key for well-known "completed progress string" property. |
static ClassConstrainedKey |
FAILED_PROGRESS_STRING_PROPERTY
Key for well-known "failed progress string" property. |
static float |
INDETERMINATE_PROGRESS
Special value for indicating indeterminate progress. |
static ClassConstrainedKey |
INITIAL_FRACTION_DONE_PROPERTY
Key for well-known "initial fraction done" property. |
static ClassConstrainedKey |
INITIAL_PROGRESS_STRING_PROPERTY
Key for well-known "initial progress string" property. |
static ClassConstrainedKey |
JOB_NAME_PROPERTY
Key for well-known job name property. |
static ClassConstrainedKey |
PRESTART_PROGRESS_STRING_PROPERTY
Key for well-known "pre-start progress string" property. |
Method Summary | |
PropertySet |
getProperties()
Get the properties for this AsyncJob. |
boolean |
interrupt(AsyncJobException exception)
Interrupt the job if it is currently running. |
Object |
run(AsyncJobProgressReporter reporter)
Run a job and report progress. |
Field Detail |
public static final float INDETERMINATE_PROGRESS
public static final ClassConstrainedKey JOB_NAME_PROPERTY
public static final ClassConstrainedKey CAN_CANCEL_PROPERTY
public static final ClassConstrainedKey INITIAL_FRACTION_DONE_PROPERTY
public static final ClassConstrainedKey INITIAL_PROGRESS_STRING_PROPERTY
public static final ClassConstrainedKey PRESTART_PROGRESS_STRING_PROPERTY
public static final ClassConstrainedKey COMPLETED_PROGRESS_STRING_PROPERTY
public static final ClassConstrainedKey FAILED_PROGRESS_STRING_PROPERTY
Method Detail |
public PropertySet getProperties()
public Object run(AsyncJobProgressReporter reporter) throws AsyncJobException
reporter
- AsyncJobProgressReporter for the job
AsyncJobException
- job failed
IllegalStateException
- job is already running.public boolean interrupt(AsyncJobException exception)
exception
- custom exception to throw
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |