Class TimeBasedDirectoryCleanerConfig
java.lang.Object
org.kiwiproject.dropwizard.config.TimeBasedDirectoryCleanerConfig
A (Dropwizard) configuration class to configure and schedule a
TimeBasedDirectoryCleaner.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.dropwizard.util.Durationstatic final io.dropwizard.util.Duration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.dropwizard.util.Durationio.dropwizard.util.Durationio.dropwizard.util.Durationio.dropwizard.util.DurationscheduleCleanupUsing(io.dropwizard.core.setup.Environment environment) Schedules directory cleanup and registers aTimeBasedDirectoryCleanerHealthCheckhealth check using the givenEnvironment, returning theTimeBasedDirectoryCleanerinstance that was scheduled.scheduleCleanupUsing(ScheduledExecutorService cleanupExecutor) Schedules directory cleanup using the givenScheduledExecutorService, returning theTimeBasedDirectoryCleanerinstance that was scheduled.voidsetCleanupInterval(io.dropwizard.util.Duration cleanupInterval) voidsetDeleteErrorLogLevel(String deleteErrorLogLevel) voidsetDirectoryPath(String directoryPath) voidsetHealthCheckWarningDuration(io.dropwizard.util.Duration healthCheckWarningDuration) voidsetInitialCleanupDelay(io.dropwizard.util.Duration initialCleanupDelay) voidsetRetentionThreshold(io.dropwizard.util.Duration retentionThreshold)
-
Field Details
-
DEFAULT_INITIAL_DELAY_MILLIS
public static final io.dropwizard.util.Duration DEFAULT_INITIAL_DELAY_MILLIS -
SHUTDOWN_DURATION
public static final io.dropwizard.util.Duration SHUTDOWN_DURATION
-
-
Constructor Details
-
TimeBasedDirectoryCleanerConfig
public TimeBasedDirectoryCleanerConfig()
-
-
Method Details
-
scheduleCleanupUsing
Schedules directory cleanup using the givenScheduledExecutorService, returning theTimeBasedDirectoryCleanerinstance that was scheduled. It can then be used to retrieve delete error information.- Parameters:
cleanupExecutor- the scheduled executor to use- Returns:
- a new TimeBasedDirectoryCleaner using the given executor
- Implementation Note:
- It is assumed that the
ScheduledExecutorServiceis externally managed and has only one thread.
-
scheduleCleanupUsing
public TimeBasedDirectoryCleaner scheduleCleanupUsing(io.dropwizard.core.setup.Environment environment) Schedules directory cleanup and registers aTimeBasedDirectoryCleanerHealthCheckhealth check using the givenEnvironment, returning theTimeBasedDirectoryCleanerinstance that was scheduled. It can then be used to retrieve delete error information.- Parameters:
environment- the Dropwizard Environment to use- Returns:
- a new TimeBasedDirectoryCleaner using the given environment
-
getDirectoryPath
-
getRetentionThreshold
public io.dropwizard.util.Duration getRetentionThreshold() -
getInitialCleanupDelay
public io.dropwizard.util.Duration getInitialCleanupDelay() -
getCleanupInterval
public io.dropwizard.util.Duration getCleanupInterval() -
getHealthCheckWarningDuration
public io.dropwizard.util.Duration getHealthCheckWarningDuration() -
getDeleteErrorLogLevel
-
setDirectoryPath
-
setRetentionThreshold
public void setRetentionThreshold(io.dropwizard.util.Duration retentionThreshold) -
setInitialCleanupDelay
public void setInitialCleanupDelay(io.dropwizard.util.Duration initialCleanupDelay) -
setCleanupInterval
public void setCleanupInterval(io.dropwizard.util.Duration cleanupInterval) -
setHealthCheckWarningDuration
public void setHealthCheckWarningDuration(io.dropwizard.util.Duration healthCheckWarningDuration) -
setDeleteErrorLogLevel
-