Package hudson.model
Class AsyncPeriodicWork
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
hudson.model.AsyncPeriodicWork
- All Implemented Interfaces:
ExtensionPoint,Runnable
- Direct Known Subclasses:
BackgroundGlobalBuildDiscarder,ConnectionActivityMonitor,DailyCheck,FingerprintCleanupThread,Telemetry.TelemetryReporter,WorkspaceCleanupThread
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.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.triggers.SafeTimerTask
SafeTimerTask.ExceptionRunnableNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsFields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StreamTaskListenerfinal voiddoRun()Schedules this periodic work now in a new thread, if one isn't already running.protected abstract voidexecute(TaskListener listener) Executes the task.protected LevelReturns the logging level at which error messages are displayed.protected FileDetermines the log file that records the result of this task.protected LevelReturns the logging level at which normal messages are displayed.protected LevelReturns the logging level at which previous task still executing messages is displayed.protected booleanMethods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, getRecurrencePeriod, initMethods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, runMethods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
name
Human readable name of the work.
-
-
Constructor Details
-
AsyncPeriodicWork
-
-
Method Details
-
doRun
public final void doRun()Schedules this periodic work now in a new thread, if one isn't already running.- Specified by:
doRunin classSafeTimerTask
-
createListener
-
getLogFile
Determines the log file that records the result of this task. -
getNormalLoggingLevel
Returns the logging level at which normal messages are displayed.- Returns:
- The logging level as @Level.
- Since:
- 1.551
-
getSlowLoggingLevel
Returns the logging level at which previous task still executing messages is displayed.- Returns:
- The logging level as @Level.
- Since:
- 1.565
-
getErrorLoggingLevel
Returns the logging level at which error messages are displayed.- Returns:
- The logging level as @Level.
- Since:
- 1.551
-
execute
Executes the task.- Parameters:
listener- Output sent will be reported to the users. (this work is TBD.)- Throws:
InterruptedException- The caller will record the exception and moves on.IOException- The caller will record the exception and moves on.
-
queueIfAlreadyRunning
protected boolean queueIfAlreadyRunning()- Returns:
- true if a new run should be queued if it is already running while called.
- Since:
- 2.517
-