Interface ServerCleanupManager
-
- All Known Implementing Classes:
ServerCleanupManagerImpl
public interface ServerCleanupManager
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_CLEANUP_CRON
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexecuteWithInactiveCleanup(Runnable runnable, boolean waitTillCleanupFinished)Executes specified runnable if cleanup is not running a critical section.CronSchedulergetCleanupStartCron()Returns cleanup start time cron scheduler.DategetCleanupStartTime()CleanupProcessStateExgetCleanupState()ConfigurationErrorsgetConfigErrors()Returns configuration errors object that holds such errors that make impossible the cleaning of removed projects and build configurations.intgetMaxCleanupDuration()booleanisCleanupCanBeStarted()Returns true if cleanup can be started (ifstartCleanup()method can be invoked)booleanisCleanupEnabled()booleanisRunningCriticalSection()Determines whether the server is running a critical data modification section (like compacting the database).voidsetCleanupEnabled(boolean enabled)Enables or disables periodical cleanup.voidsetCleanupStartCron(String cronExpression)Sets cleanup start timevoidsetMaxCleanupDuration(int durationMins)Sets maximum allowed cleanup duration in minutes.voidstartCleanup()Starts cleanup process.voidstopCleanup(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 CronParseExceptionSets 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 CleanupCannotBeStartedExceptionStarts 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, ornullif 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
-
-