|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
public abstract class PeriodicWork
Extension point to perform a periodic task in Hudson (through 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.
AsyncPeriodicWork
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Field Summary | |
---|---|
protected static long |
DAY
|
protected static long |
HOUR
|
protected Logger |
logger
|
protected static long |
MIN
|
Constructor Summary | |
---|---|
PeriodicWork()
|
Method Summary | |
---|---|
static ExtensionList<PeriodicWork> |
all()
Returns all the registered PeriodicWork s. |
long |
getInitialDelay()
Gets the number of milliseconds til the first execution. |
abstract long |
getRecurrencePeriod()
Gets the number of milliseconds between successive executions. |
Methods inherited from class hudson.triggers.SafeTimerTask |
---|
doRun, run |
Methods inherited from class java.util.TimerTask |
---|
cancel, scheduledExecutionTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Logger logger
protected static final long MIN
protected static final long HOUR
protected static final long DAY
Constructor Detail |
---|
public PeriodicWork()
Method Detail |
---|
public abstract long getRecurrencePeriod()
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.
public long getInitialDelay()
By default it chooses the value randomly between 0 and getRecurrencePeriod()
public static ExtensionList<PeriodicWork> all()
PeriodicWork
s.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |