Class PeriodicWork
- All Implemented Interfaces:
- ExtensionPoint,- Runnable
- Direct Known Subclasses:
- AsyncPeriodicWork,- HudsonHomeDiskUsageChecker,- LoadStatistics.LoadStatisticsUpdater,- MemoryUsageMonitor,- NodeProvisioner.NodeProvisionerInvoker,- Trigger.Cron
Timer.)
 This extension point is useful if your plugin needs to perform some work in the background periodically (for example, monitoring, batch processing, garbage collection, etc.)
 Put Extension on your class to have it picked up and registered automatically, or
 manually insert this to Trigger.timer.
 
 This class is designed to run a short task. Implementations whose periodic work takes a long time
 to run should extend from AsyncPeriodicWork instead.
- Author:
- Kohsuke Kawaguchi
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class hudson.triggers.SafeTimerTaskSafeTimerTask.ExceptionRunnableNested classes/interfaces inherited from interface hudson.ExtensionPointExtensionPoint.LegacyInstancesAreScopedToHudson
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic ExtensionList<PeriodicWork> all()Returns all the registeredPeriodicWorks.longGets the number of milliseconds til the first execution.abstract longGets the number of milliseconds between successive executions.static voidinit()Methods inherited from class hudson.triggers.SafeTimerTaskdoRun, getLogsRoot, of, runMethods inherited from class java.util.TimerTaskcancel, scheduledExecutionTime
- 
Field Details- 
loggerDeprecated.Use your own logger, or send messages to the logger inAsyncPeriodicWork.execute(hudson.model.TaskListener).
- 
MINprotected static final long MIN- See Also:
 
- 
HOURprotected static final long HOUR- See Also:
 
- 
DAYprotected static final long DAY- See Also:
 
 
- 
- 
Constructor Details- 
PeriodicWorkpublic PeriodicWork()
 
- 
- 
Method Details- 
getRecurrencePeriodpublic abstract long getRecurrencePeriod()Gets the number of milliseconds between successive executions.Hudson calls this method once to set up a recurring timer, instead of calling this each time after the previous execution completed. So this class cannot be used to implement a non-regular recurring timer. IOW, the method should always return the same value. 
- 
getInitialDelaypublic long getInitialDelay()Gets the number of milliseconds til the first execution.By default it chooses the value randomly between 0 and getRecurrencePeriod()
- 
allReturns all the registeredPeriodicWorks.
- 
init
 
- 
AsyncPeriodicWork.execute(hudson.model.TaskListener).