public abstract class AsyncPeriodicWork extends PeriodicWork
PeriodicWork
that takes a long time to run.
Subclasses will implement the execute(TaskListener)
method and can carry out a long-running task.
This runs in a separate thread so as not to block the timer thread, and this class handles
all those details.
SafeTimerTask.ExceptionRunnable
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
String |
name
Human readable name of the work.
|
DAY, HOUR, logger, MIN
Modifier | Constructor and Description |
---|---|
protected |
AsyncPeriodicWork(String name) |
Modifier and Type | Method and Description |
---|---|
protected StreamTaskListener |
createListener() |
void |
doRun()
Schedules this periodic work now in a new thread, if one isn't already running.
|
protected abstract void |
execute(TaskListener listener)
Executes the task.
|
protected Level |
getErrorLoggingLevel()
Returns the logging level at which error messages are displayed.
|
protected File |
getLogFile()
Determines the log file that records the result of this task.
|
protected Level |
getNormalLoggingLevel()
Returns the logging level at which normal messages are displayed.
|
protected Level |
getSlowLoggingLevel()
Returns the logging level at which previous task still executing messages is displayed.
|
all, getInitialDelay, getRecurrencePeriod, init
getLogsRoot, of, run
cancel, scheduledExecutionTime
public final String name
protected AsyncPeriodicWork(String name)
public final void doRun()
doRun
in class SafeTimerTask
protected StreamTaskListener createListener()
protected File getLogFile()
protected Level getNormalLoggingLevel()
protected Level getSlowLoggingLevel()
protected Level getErrorLoggingLevel()
protected abstract void execute(TaskListener listener) throws IOException, InterruptedException
listener
- Output sent will be reported to the users. (this work is TBD.)InterruptedException
- The caller will record the exception and moves on.IOException
- The caller will record the exception and moves on.Copyright © 2004–2021. All rights reserved.