public abstract class Task extends Handle implements Runnable
Handle.ObjectDiscarder, Handle.WaitOnChange
Aborted, Changed, DEFAULT_CHANGE_ACCEPT_TIME, DEFAULT_PROGRESS_RESOLUTION, doing, error, Failed, Failure, OPTION_STOP_IF_NOT_SET, OPTION_TIMEOUT_IF_NOT_SET, progress, progressResolution, returnCode, returnValue, Running, shouldStop, startTime, state, Stopped, stopReason, subHandle, Succeeded, Success, waitChangeAcceptedTime
Constructor and Description |
---|
Task() |
Modifier and Type | Method and Description |
---|---|
protected void |
complete()
This is called after doRun() has exited and the Stopped flags have been set.
|
protected abstract void |
doRun()
Override this to provide functionality for the Task.
|
boolean |
getDaemon() |
Thread |
getThread()
Get the thread that is executing this task.
|
protected void |
interrupt() |
void |
run()
Do not override this method, override the doRun() method to provide
Task functionality.
|
void |
setDaemon(boolean on)
This must be called before the Task is started.
|
void |
setThreadGroup(ThreadGroup group)
Call this BEFORE calling start().
|
protected boolean |
sleep(int milliseconds)
Cause the current thread to sleep for a certain length of time.
|
Handle |
start()
Start the Task at normal priority.
|
Task |
start(int priority)
Start the Task at normal priority.
|
addParent, changeAccepted, changed, check, check, checkAbortFail, checkAny, checkChangeAccepted, checkFailure, convertError, doChangeTo, fail, getChangeState, getErrorText, getFinalReturnValue, getProperties, getReturnValue, getStoppableWaitOnSuccess, getUnwrappedReturnValue, hasStopped, newWaitOnChange, removeParent, resetProgress, set, setFlags, setProgress, setProgress, setResult, setReturnValue, startDoing, stop, succeed, succeeded, throwErrorIfNotStopped, throwRuntimeError, throwRuntimeError, throwRuntimeError, throwRuntimeError, timeout, timeout, waitChangeAccepted, waitForReturnValue, waitOn, waitOn, waitOn, waitOn, waitOnAny, waitOnAny, waitOnAny, waitOnAny, waitOnChange, waitOnResult, waitOnSuccess, waitOnSuccess, waitReturnValue, waitUntilCompletion, waitUntilCompletion, waitUntilStopped, waitUntilStopped, wasAborted, yield
public void setThreadGroup(ThreadGroup group)
public void setDaemon(boolean on)
on
- true to set the Task as a Daemon, false if not.public boolean getDaemon()
public Handle start()
public Task start(int priority)
priority
- a Thread.XXX_PRIORITY value.public final void run()
protected void complete()
protected abstract void doRun()
protected boolean sleep(int milliseconds)
milliseconds
- The time to sleep for.public final Thread getThread()