public class TimeBasedCleanupPolicy extends Object implements RollingFileMessageWriter.CleanupPolicy
Constructor and Description |
---|
TimeBasedCleanupPolicy(int units,
TimeUnit resolution,
String rollingFilePattern)
Create a time based cleanup policy using the system clock for parsing timestampts.
|
TimeBasedCleanupPolicy(int units,
TimeUnit resolution,
String rollingFilePattern,
Clock clock)
Create a time based cleanup policy.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getFilesToDelete(List<String> candidateFiles,
String currentFileName)
Get a list of files that needs to be deleted because of the cleanup policy.
|
public TimeBasedCleanupPolicy(int units, TimeUnit resolution, String rollingFilePattern)
units
- The amount of time back to keep files for.resolution
- The unit of time to keep files for.rollingFilePattern
- Pattern matching the files, see TimeBasedRollingPolicy
.public TimeBasedCleanupPolicy(int units, TimeUnit resolution, String rollingFilePattern, Clock clock)
units
- The amount of time back to keep files for.resolution
- The unit of time to keep files for.rollingFilePattern
- Pattern matching the files, see TimeBasedRollingPolicy
.clock
- The clock to use.@Nonnull public List<String> getFilesToDelete(@Nonnull List<String> candidateFiles, @Nonnull String currentFileName)
RollingFileMessageWriter.CleanupPolicy
getFilesToDelete
in interface RollingFileMessageWriter.CleanupPolicy
candidateFiles
- List of the files that can be cleaned up. This does NOT
include the currently written files (current file and
symlink).currentFileName
- The current file name.Copyright © 2015–2017 morimekta.net. All rights reserved.