Class TimeBasedArchiveRemover

    • Field Detail

      • INACTIVITY_TOLERANCE_IN_MILLIS

        protected static final long INACTIVITY_TOLERANCE_IN_MILLIS
        See Also:
        Constant Field Values
      • MAX_VALUE_FOR_INACTIVITY_PERIODS

        static final int MAX_VALUE_FOR_INACTIVITY_PERIODS
        See Also:
        Constant Field Values
      • maxHistory

        private int maxHistory
      • totalSizeCap

        private long totalSizeCap
      • parentClean

        final boolean parentClean
      • lastHeartBeat

        long lastHeartBeat
      • callCount

        int callCount
    • Method Detail

      • clean

        public void clean​(java.util.Date now)
        Specified by:
        clean in interface ArchiveRemover
      • getFilesInPeriod

        protected java.io.File[] getFilesInPeriod​(java.util.Date dateOfPeriodToClean)
      • fileExistsAndIsFile

        private boolean fileExistsAndIsFile​(java.io.File file2Delete)
      • cleanPeriod

        public void cleanPeriod​(java.util.Date dateOfPeriodToClean)
      • capTotalSize

        void capTotalSize​(java.util.Date now)
      • descendingSortByLastModified

        private void descendingSortByLastModified​(java.io.File[] matchingFileArray)
      • getParentDir

        java.io.File getParentDir​(java.io.File file)
      • computeElapsedPeriodsSinceLastClean

        int computeElapsedPeriodsSinceLastClean​(long nowInMillis)
      • computeParentCleaningFlag

        boolean computeParentCleaningFlag​(FileNamePattern fileNamePattern)
      • removeFolderIfEmpty

        void removeFolderIfEmpty​(java.io.File dir)
      • removeFolderIfEmpty

        private void removeFolderIfEmpty​(java.io.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 -
      • getPeriodOffsetForDeletionTarget

        protected int getPeriodOffsetForDeletionTarget()
      • toString

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

        public java.util.concurrent.Future<?> cleanAsynchronously​(java.util.Date now)
        Specified by:
        cleanAsynchronously in interface ArchiveRemover