public class TimeBasedArchiveRemover extends ContextAwareBase implements ArchiveRemover
| Modifier and Type | Class and Description |
|---|---|
class |
TimeBasedArchiveRemover.ArhiveRemoverRunnable |
| Modifier and Type | Field and Description |
|---|---|
(package private) FileNamePattern |
fileNamePattern |
protected static long |
INACTIVITY_TOLERANCE_IN_MILLIS |
(package private) long |
lastHeartBeat |
(package private) static int |
MAX_VALUE_FOR_INACTIVITY_PERIODS |
private int |
maxHistory |
(package private) boolean |
parentClean |
(package private) RollingCalendar |
rc |
private long |
totalSizeCap |
protected static long |
UNINITIALIZED |
private static int |
UNTOUCHABLE_ARCHIVE_FILE_COUNT |
context| Constructor and Description |
|---|
TimeBasedArchiveRemover(FileNamePattern fileNamePattern,
RollingCalendar rc) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
capTotalSize(java.util.Date now) |
void |
clean(java.util.Date now) |
java.util.concurrent.Future<?> |
cleanAsynchronously(java.util.Date now) |
void |
cleanPeriod(java.util.Date dateOfPeriodToClean) |
(package private) int |
computeElapsedPeriodsSinceLastClean(long nowInMillis) |
(package private) boolean |
computeParentCleaningFlag(FileNamePattern fileNamePattern) |
private void |
descendingSortByLastModified(java.io.File[] matchingFileArray) |
private boolean |
fileExistsAndIsFile(java.io.File file2Delete) |
protected java.io.File[] |
getFilesInPeriod(java.util.Date dateOfPeriodToClean) |
(package private) java.io.File |
getParentDir(java.io.File file) |
protected int |
getPeriodOffsetForDeletionTarget() |
(package private) void |
removeFolderIfEmpty(java.io.File dir) |
private void |
removeFolderIfEmpty(java.io.File dir,
int depth)
Will remove the directory passed as parameter if empty.
|
void |
setMaxHistory(int maxHistory) |
void |
setTotalSizeCap(long totalSizeCap) |
java.lang.String |
toString() |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextprivate static final int UNTOUCHABLE_ARCHIVE_FILE_COUNT
protected static final long UNINITIALIZED
protected static final long INACTIVITY_TOLERANCE_IN_MILLIS
static final int MAX_VALUE_FOR_INACTIVITY_PERIODS
final FileNamePattern fileNamePattern
final RollingCalendar rc
private int maxHistory
private long totalSizeCap
final boolean parentClean
long lastHeartBeat
public TimeBasedArchiveRemover(FileNamePattern fileNamePattern, RollingCalendar rc)
public void clean(java.util.Date now)
clean in interface ArchiveRemoverprotected java.io.File[] getFilesInPeriod(java.util.Date dateOfPeriodToClean)
private boolean fileExistsAndIsFile(java.io.File file2Delete)
public void cleanPeriod(java.util.Date dateOfPeriodToClean)
void capTotalSize(java.util.Date now)
private void descendingSortByLastModified(java.io.File[] matchingFileArray)
java.io.File getParentDir(java.io.File file)
int computeElapsedPeriodsSinceLastClean(long nowInMillis)
boolean computeParentCleaningFlag(FileNamePattern fileNamePattern)
void removeFolderIfEmpty(java.io.File dir)
private void removeFolderIfEmpty(java.io.File dir,
int depth)
dir - depth - public void setMaxHistory(int maxHistory)
setMaxHistory in interface ArchiveRemoverprotected int getPeriodOffsetForDeletionTarget()
public void setTotalSizeCap(long totalSizeCap)
setTotalSizeCap in interface ArchiveRemoverpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.concurrent.Future<?> cleanAsynchronously(java.util.Date now)
cleanAsynchronously in interface ArchiveRemover