Class KeepLastNCleanupPolicy
- java.lang.Object
-
- net.morimekta.providence.logging.rolling.KeepLastNCleanupPolicy
-
- All Implemented Interfaces:
RollingFileMessageWriter.CleanupPolicy
public class KeepLastNCleanupPolicy extends java.lang.Object implements RollingFileMessageWriter.CleanupPolicy
Cleanup policy that keeps the N previous files. This means there should be no more thanN + 1
files or the writer at any time.
-
-
Constructor Summary
Constructors Constructor Description KeepLastNCleanupPolicy(int keepLastN, java.lang.String filePattern)
KeepLastNCleanupPolicy(int keepLastN, java.util.regex.Pattern filePattern)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>
getFilesToDelete(java.util.List<java.lang.String> candidateFiles, java.lang.String currentFileName)
Get a list of files that needs to be deleted because of the cleanup policy.
-
-
-
Method Detail
-
getFilesToDelete
@Nonnull public java.util.List<java.lang.String> getFilesToDelete(@Nonnull java.util.List<java.lang.String> candidateFiles, @Nonnull java.lang.String currentFileName)
Description copied from interface:RollingFileMessageWriter.CleanupPolicy
Get a list of files that needs to be deleted because of the cleanup policy.- Specified by:
getFilesToDelete
in interfaceRollingFileMessageWriter.CleanupPolicy
- Parameters:
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.- Returns:
- List of files that needs to be deleted.
-
-