Interface ServerCleanupManager
-
- All Known Implementing Classes:
ServerCleanupManagerImpl
public interface ServerCleanupManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CLEANUP_CRON
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
executeWithInactiveCleanup(Runnable runnable, boolean waitTillCleanupFinished)
Executes specified runnable if cleanup is not running a critical section.CronScheduler
getCleanupStartCron()
Returns cleanup start time cron scheduler.Date
getCleanupStartTime()
CleanupProcessStateEx
getCleanupState()
ConfigurationErrors
getConfigErrors()
Returns configuration errors object that holds such errors that make impossible the cleaning of removed projects and build configurations.int
getMaxCleanupDuration()
boolean
isCleanupCanBeStarted()
Returns true if cleanup can be started (ifstartCleanup()
method can be invoked)boolean
isCleanupEnabled()
boolean
isRunningCriticalSection()
Determines whether the server is running a critical data modification section (like compacting the database).void
setCleanupEnabled(boolean enabled)
Enables or disables periodical cleanup.void
setCleanupStartCron(String cronExpression)
Sets cleanup start timevoid
setMaxCleanupDuration(int durationMins)
Sets maximum allowed cleanup duration in minutes.void
startCleanup()
Starts cleanup process.void
stopCleanup(SUser userPerformingAction)
Stops cleanup.
-
-
-
Field Detail
-
DEFAULT_CLEANUP_CRON
static final String DEFAULT_CLEANUP_CRON
- See Also:
- Constant Field Values
-
-
Method Detail
-
setCleanupStartCron
void setCleanupStartCron(@NotNull String cronExpression) throws CronParseException
Sets cleanup start time- Parameters:
cronExpression
- cleanup start time cron expression- Throws:
CronParseException
-
setCleanupEnabled
void setCleanupEnabled(boolean enabled)
Enables or disables periodical cleanup. If enabled, cleanup will start at specified start time. If start time is not specified, cleanup will start at 03:00- Parameters:
enabled
- is periodical cleanup enabled
-
isCleanupEnabled
boolean isCleanupEnabled()
- Returns:
- true if cleanup is enabled
-
setMaxCleanupDuration
void setMaxCleanupDuration(int durationMins)
Sets maximum allowed cleanup duration in minutes. Note that in fact cleanup can take a bit more time than specified in this setting, this is because cleanup operation can't be interrupted at any time.- Parameters:
durationMins
- max cleanup duration in minutes, 0 or negative value will disable cleanup duration check
-
getMaxCleanupDuration
int getMaxCleanupDuration()
- Returns:
- max cleanup duration in minutes
-
getCleanupStartCron
@NotNull CronScheduler getCleanupStartCron()
Returns cleanup start time cron scheduler.
-
getCleanupStartTime
@NotNull Date getCleanupStartTime()
-
getCleanupState
@NotNull CleanupProcessStateEx getCleanupState()
- Returns:
- details about last (current or finished) server cleanup.
-
startCleanup
void startCleanup() throws CleanupCannotBeStartedException
Starts cleanup process. The method will not return until the cleanup process is finished.- Throws:
CleanupCannotBeStartedException
-
stopCleanup
void stopCleanup(@Nullable SUser userPerformingAction)
Stops cleanup.- Parameters:
userPerformingAction
- user who performs this action, ornull
if action is performed by system
-
isCleanupCanBeStarted
boolean isCleanupCanBeStarted()
Returns true if cleanup can be started (ifstartCleanup()
method can be invoked)- Returns:
- see above
-
executeWithInactiveCleanup
boolean executeWithInactiveCleanup(@NotNull Runnable runnable, boolean waitTillCleanupFinished)
Executes specified runnable if cleanup is not running a critical section. Cleanup will not start a critical data modification section while runnable is executing. If parameter waitTillFinished is true the method will wait till cleanup is finished.- Parameters:
runnable
- runnable to executewaitTillCleanupFinished
- true to wait till cleanup finishes- Returns:
- true if runnable was executed
-
isRunningCriticalSection
boolean isRunningCriticalSection()
Determines whether the server is running a critical data modification section (like compacting the database).- Returns:
- see above
- Since:
- 9.0
- See Also:
executeWithInactiveCleanup(Runnable, boolean)
-
getConfigErrors
@NotNull ConfigurationErrors getConfigErrors()
Returns configuration errors object that holds such errors that make impossible the cleaning of removed projects and build configurations.- Since:
- 2021.1
-
-