public class WorkerAnt extends Thread
This class is effectively a superset of
Parallel.TaskRunnable
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_NO_TASK
Error message if invoked with no task
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
WorkerAnt(Task task)
Create the worker, using the worker as the notification point.
|
WorkerAnt(Task task,
Object notify)
Create the worker.
|
Modifier and Type | Method and Description |
---|---|
BuildException |
getBuildException()
Get any build exception.
|
Throwable |
getException()
Get whatever was thrown, which may or may not be a buildException.
|
Task |
getTask()
Get the task
|
boolean |
isFinished()
Query the task/thread for being finished.
|
void |
rethrowAnyBuildException()
Raise an exception if one was caught
|
void |
run()
Run the task, which is skipped if null.
|
void |
waitUntilFinished(long timeout)
Block on the notify object and so wait until the thread is finished.
|
activeCount, checkAccess, currentThread, dumpStack, enumerate, getAllStackTraces, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
public static final String ERROR_NO_TASK
public WorkerAnt(Task task)
This does not start the thread, merely configures it.
task
- the taskpublic BuildException getBuildException()
public Throwable getException()
public Task getTask()
public boolean isFinished()
public void rethrowAnyBuildException()
BuildException
- if one has been picked uppublic void run()
run
in interface Runnable
run
in class Thread
Thread.run()
public void waitUntilFinished(long timeout) throws InterruptedException
timeout
- timeout in millisecondsInterruptedException
- if the execution was interrupted