public abstract class AperiodicWork extends SafeTimerTask implements ExtensionPoint
getRecurrencePeriod()
. Task to be scheduled is obtain by calling getNewInstance()
.
This class is similar to PeriodicWork
. The main difference is in re-evaluating delay interval every time.
See PeriodicWork
for details. Analog of AsyncPeriodicWork
is AsyncAperiodicWork
.
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
AperiodicWork() |
Modifier and Type | Method and Description |
---|---|
static ExtensionList<AperiodicWork> |
all()
Returns all the registered
AperiodicWork s. |
protected abstract void |
doAperiodicRun() |
void |
doRun() |
long |
getInitialDelay()
Gets the number of milliseconds till the first execution.
|
abstract AperiodicWork |
getNewInstance()
Gets new instance of task to be executed.
|
abstract long |
getRecurrencePeriod()
Gets the number of milliseconds between successive executions.
|
static void |
init() |
run
cancel, scheduledExecutionTime
protected final Logger logger
public abstract long getRecurrencePeriod()
Jenkins calls this method every time the timer task is scheduled.
public abstract AperiodicWork getNewInstance()
IllegalStateException
(especially
in case of AsyncAperiodicWork
) and therefore scheduling of next tasks will be broken.public long getInitialDelay()
By default it chooses the value randomly between 0 and getRecurrencePeriod()
public final void doRun() throws Exception
doRun
in class SafeTimerTask
Exception
@Initializer(after=JOB_LOADED) public static void init()
protected abstract void doAperiodicRun()
public static ExtensionList<AperiodicWork> all()
AperiodicWork
s.Copyright © 2018. All rights reserved.