|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.apache.tools.ant.util.WorkerAnt
public class WorkerAnt
A worker ant executes a single task in a background thread. After the run, any exception thrown is turned into a buildexception, which can be rethrown, the finished attribute is set, then notifyAll() is called, so that anyone waiting on the same notify object gets woken up.
This class is effectively a superset ofParallel.TaskRunnable
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
ERROR_NO_TASK
Error message if invoked with no task |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
WorkerAnt(Task task)
Create the worker, using the worker as the notification point. |
|
WorkerAnt(Task task,
java.lang.Object notify)
Create the worker. |
Method Summary | |
---|---|
BuildException |
getBuildException()
Get any build exception. |
java.lang.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. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ERROR_NO_TASK
Constructor Detail |
---|
public WorkerAnt(Task task, java.lang.Object notify)
task
- the tasknotify
- what to notifypublic WorkerAnt(Task task)
task
- the taskMethod Detail |
---|
public BuildException getBuildException()
public java.lang.Throwable getException()
public Task getTask()
public boolean isFinished()
public void waitUntilFinished(long timeout) throws java.lang.InterruptedException
timeout
- timeout in milliseconds
java.lang.InterruptedException
- if the execution was interruptedpublic void rethrowAnyBuildException()
BuildException
- if one has been picked uppublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |