public abstract class TaskThread extends Thread
Thread for performing one-off task.
Designed to be used inside TaskAction.
TaskAction| Modifier and Type | Class and Description |
|---|---|
static class |
TaskThread.ListenerAndText
Tuple of
TaskListener and AnnotatedLargeText, representing
the interface for producing output and how to retrieve it later. |
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier | Constructor and Description |
|---|---|
protected |
TaskThread(TaskAction owner,
TaskThread.ListenerAndText output) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
associateWith(TaskAction action)
Registers that this
TaskThread is run for the specified
TaskAction. |
protected TaskThread.ListenerAndText |
createListener()
Determines where the output of this
TaskThread goes. |
boolean |
isRunning() |
protected abstract void |
perform(TaskListener listener)
Do the actual work.
|
Reader |
readAll() |
void |
run() |
void |
start()
Starts the task execution asynchronously.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldprotected TaskThread(TaskAction owner, TaskThread.ListenerAndText output)
output - Determines where the output from this task thread goes.public Reader readAll() throws IOException
IOExceptionprotected final void associateWith(TaskAction action)
TaskThread is run for the specified
TaskAction. This can be explicitly called from subtypes
to associate a single TaskThread across multiple tag actions.public void start()
public boolean isRunning()
protected TaskThread.ListenerAndText createListener() throws IOException
TaskThread goes.
Subclass can override this to send the output to a file, for example.
IOExceptionprotected abstract void perform(TaskListener listener) throws Exception
Exception - The exception is recorded and reported as a failure.Copyright © 2019. All rights reserved.