Class TimeBasedArchiveRemover

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover
All Implemented Interfaces:
ArchiveRemover, ContextAware
Direct Known Subclasses:
SizeAndTimeBasedArchiveRemover

public class TimeBasedArchiveRemover extends ContextAwareBase implements ArchiveRemover
  • Field Details

    • UNINITIALIZED

      protected static final long UNINITIALIZED
      See Also:
    • INACTIVITY_TOLERANCE_IN_MILLIS

      protected static final long INACTIVITY_TOLERANCE_IN_MILLIS
      See Also:
    • MAX_VALUE_FOR_INACTIVITY_PERIODS

      static final int MAX_VALUE_FOR_INACTIVITY_PERIODS
      See Also:
    • fileNamePattern

      final FileNamePattern fileNamePattern
    • rc

      final RollingCalendar rc
    • maxHistory

      private int maxHistory
    • totalSizeCap

      private long totalSizeCap
    • parentClean

      final boolean parentClean
    • lastHeartBeat

      long lastHeartBeat
    • callCount

      int callCount
  • Constructor Details

  • Method Details

    • clean

      public void clean(Date now)
      Specified by:
      clean in interface ArchiveRemover
    • getFilesInPeriod

      protected File[] getFilesInPeriod(Date dateOfPeriodToClean)
    • fileExistsAndIsFile

      private boolean fileExistsAndIsFile(File file2Delete)
    • cleanPeriod

      public void cleanPeriod(Date dateOfPeriodToClean)
    • capTotalSize

      void capTotalSize(Date now)
    • descendingSortByLastModified

      private void descendingSortByLastModified(File[] matchingFileArray)
    • getParentDir

      File getParentDir(File file)
    • computeElapsedPeriodsSinceLastClean

      int computeElapsedPeriodsSinceLastClean(long nowInMillis)
    • computeParentCleaningFlag

      boolean computeParentCleaningFlag(FileNamePattern fileNamePattern)
    • removeFolderIfEmpty

      void removeFolderIfEmpty(File dir)
    • removeFolderIfEmpty

      private void removeFolderIfEmpty(File dir, int depth)
      Will remove the directory passed as parameter if empty. After that, if the parent is also becomes empty, remove the parent dir as well but at most 3 times.
      Parameters:
      dir -
      depth -
    • setMaxHistory

      public void setMaxHistory(int maxHistory)
      Specified by:
      setMaxHistory in interface ArchiveRemover
    • getPeriodOffsetForDeletionTarget

      protected int getPeriodOffsetForDeletionTarget()
    • setTotalSizeCap

      public void setTotalSizeCap(long totalSizeCap)
      Specified by:
      setTotalSizeCap in interface ArchiveRemover
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • cleanAsynchronously

      public Future<?> cleanAsynchronously(Date now)
      Specified by:
      cleanAsynchronously in interface ArchiveRemover