Package sh.createos.jenkins.sandbox
Class CreateOSSandboxSweep
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
hudson.model.AsyncPeriodicWork
sh.createos.jenkins.sandbox.CreateOSSandboxSweep
- All Implemented Interfaces:
ExtensionPoint,Runnable
Destroys sandboxes this controller created but no longer has an agent for.
This is what makes it safe for CreateOSCloud.recoverStaleAgents() to reconnect an
agent instead of terminating it. Reconnecting accepts that a sandbox can outlive the controller
process; without a sweep, a node that disappears while the controller is down — deleted by an
administrator, lost with a rolled-back JENKINS_HOME, or abandoned when a reconnect
deadline passed unobserved — would leave a microVM billing with nothing left to attribute it to.
Terminating on startup used to rule that out by construction.
Only sandboxes named by this controller are considered, so a sandbox belonging to another Jenkins instance on the same CreateOS account, or to a human, is never touched.
-
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
Fields inherited from class hudson.model.AsyncPeriodicWork
nameFields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN -
Constructor Summary
ConstructorsConstructorDescriptionRegisters the sweep with Jenkins' periodic work scheduler. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecute(TaskListener listener) longGives resumed Pipelines time to restore their exec reservations before the first orphan sweep.longMethods inherited from class hudson.model.AsyncPeriodicWork
createListener, doRun, getErrorLoggingLevel, getLogFile, getNormalLoggingLevel, getSlowLoggingLevel, queueIfAlreadyRunningMethods inherited from class hudson.model.PeriodicWork
all, initMethods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, runMethods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
CreateOSSandboxSweep
public CreateOSSandboxSweep()Registers the sweep with Jenkins' periodic work scheduler.
-
-
Method Details
-
getRecurrencePeriod
public long getRecurrencePeriod()- Specified by:
getRecurrencePeriodin classPeriodicWork
-
getInitialDelay
public long getInitialDelay()Gives resumed Pipelines time to restore their exec reservations before the first orphan sweep.- Overrides:
getInitialDelayin classPeriodicWork
-
execute
- Specified by:
executein classAsyncPeriodicWork
-