Package hudson.model
Class TaskThread
java.lang.Object
java.lang.Thread
hudson.model.TaskThread
- All Implemented Interfaces:
Runnable
Thread for performing one-off task.
Designed to be used inside TaskAction.
- Since:
- 1.191
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classTuple ofTaskListenerandAnnotatedLargeText, representing the interface for producing output and how to retrieve it later.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTaskThread(TaskAction owner, TaskThread.ListenerAndText output) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidassociateWith(TaskAction action) Registers that thisTaskThreadis run for the specifiedTaskAction.protected TaskThread.ListenerAndTextDetermines where the output of thisTaskThreadgoes.booleanprotected abstract voidperform(TaskListener listener) Do the actual work.readAll()final voidrun()voidstart()Starts the task execution asynchronously.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
Constructor Details
-
TaskThread
- Parameters:
output- Determines where the output from this task thread goes.
-
-
Method Details
-
readAll
- Throws:
IOException
-
associateWith
Registers that thisTaskThreadis run for the specifiedTaskAction. This can be explicitly called from subtypes to associate a singleTaskThreadacross multiple tag actions. -
start
public void start()Starts the task execution asynchronously. -
isRunning
public boolean isRunning() -
createListener
Determines where the output of thisTaskThreadgoes.Subclass can override this to send the output to a file, for example.
- Throws:
IOException
-
run
public final void run() -
perform
Do the actual work.- Throws:
Exception- The exception is recorded and reported as a failure.
-