Package hudson.model
Class WorkspaceCleanupThread
java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
hudson.model.AsyncPeriodicWork
hudson.model.WorkspaceCleanupThread
- All Implemented Interfaces:
ExtensionPoint
,Runnable
@Extension
@Symbol("workspaceCleanup")
public class WorkspaceCleanupThread
extends AsyncPeriodicWork
Clean up old left-over workspaces from agents.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.triggers.SafeTimerTask
SafeTimerTask.ExceptionRunnable
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
Can be used to disable workspace clean up.static final int
How often the clean up should run.static int
Number of days workspaces should be retained.Fields inherited from class hudson.model.AsyncPeriodicWork
name
Fields inherited from class hudson.model.PeriodicWork
DAY, HOUR, logger, MIN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
execute
(TaskListener listener) Executes the task.long
Gets the number of milliseconds between successive executions.static void
invoke()
Methods inherited from class hudson.model.AsyncPeriodicWork
createListener, doRun, getErrorLoggingLevel, getLogFile, getNormalLoggingLevel, getSlowLoggingLevel
Methods inherited from class hudson.model.PeriodicWork
all, getInitialDelay, init
Methods inherited from class hudson.triggers.SafeTimerTask
getLogsRoot, of, run
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
disabled
public static boolean disabledCan be used to disable workspace clean up. -
recurrencePeriodHours
public static final int recurrencePeriodHoursHow often the clean up should run. This is final as Jenkins will not reflect changes anyway. -
retainForDays
public static int retainForDaysNumber of days workspaces should be retained.
-
-
Constructor Details
-
WorkspaceCleanupThread
public WorkspaceCleanupThread()
-
-
Method Details
-
getRecurrencePeriod
public long getRecurrencePeriod()Description copied from class:PeriodicWork
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.
- Specified by:
getRecurrencePeriod
in classPeriodicWork
-
invoke
public static void invoke() -
execute
Description copied from class:AsyncPeriodicWork
Executes the task.- Specified by:
execute
in classAsyncPeriodicWork
- Parameters:
listener
- Output sent will be reported to the users. (this work is TBD.)- Throws:
InterruptedException
- The caller will record the exception and moves on.IOException
- The caller will record the exception and moves on.
-