Class RetentionPeriodicWork
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
io.jenkins.plugins.batchcontrol.ops.RetentionPeriodicWork
- All Implemented Interfaces:
ExtensionPoint,Runnable
@Extension
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class RetentionPeriodicWork
extends PeriodicWork
Daily retention cleanup (SPEC item 12): deletes every month bucket older than the configured
retentionMonths — the runs and changes JSONL files, that month's diff patches, and
that month's incidents (index + XMLs) — and records each deleted month as
ChangeRecord(type=RETENTION) identifying the month as YYYY-MM.
A month is deleted when it lies strictly before currentMonth - retentionMonths,
so the current (partial) month plus the last retentionMonths full months are always
kept (conservative deletion). Closed requests and ended grants last active before that month
are deleted too. Every deletion holds only the lock of the file it deletes, so the sweep
never stalls the queue gate or build completion.
This is a synchronous PeriodicWork (not AsyncPeriodicWork, whose
doRun() is public final and merely starts a background thread): the test
contract calls doRun() directly and asserts the cleanup has completed on return,
and a once-a-day directory sweep is cheap enough to run inline.
-
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.PeriodicWork
DAY, HOUR, logger, MIN -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, initMethods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, runMethods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
RetentionPeriodicWork
public RetentionPeriodicWork()
-
-
Method Details
-
getRecurrencePeriod
public long getRecurrencePeriod()- Specified by:
getRecurrencePeriodin classPeriodicWork
-
doRun
public void doRun()- Specified by:
doRunin classSafeTimerTask
-