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.ExceptionRunnable
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected StreamTaskListener
final 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
Returns the logging level at which error messages are displayed.protected File
Determines the log file that records the result of this task.protected Level
Returns the logging level at which normal messages are displayed.protected Level
Returns the logging level at which previous task still executing messages is displayed.Methods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, getRecurrencePeriod, init
Methods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, run
Methods 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:
doRun
in 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.
-