Class TimeBasedCleanupPolicy

    • Constructor Summary

      Constructors 
      Constructor Description
      TimeBasedCleanupPolicy​(int units, java.util.concurrent.TimeUnit resolution, java.lang.String rollingFilePattern)
      Create a time based cleanup policy using the system clock for parsing timestampts.
      TimeBasedCleanupPolicy​(int units, java.util.concurrent.TimeUnit resolution, java.lang.String rollingFilePattern, java.time.Clock clock)
      Create a time based cleanup policy.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeBasedCleanupPolicy

        public TimeBasedCleanupPolicy​(int units,
                                      java.util.concurrent.TimeUnit resolution,
                                      java.lang.String rollingFilePattern)
        Create a time based cleanup policy using the system clock for parsing timestampts.
        Parameters:
        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.
      • TimeBasedCleanupPolicy

        public TimeBasedCleanupPolicy​(int units,
                                      java.util.concurrent.TimeUnit resolution,
                                      java.lang.String rollingFilePattern,
                                      java.time.Clock clock)
        Create a time based cleanup policy.
        Parameters:
        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.
    • 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 interface RollingFileMessageWriter.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.