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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
(package private) final FileNamePattern
protected static final long
(package private) long
(package private) static final int
private int
(package private) final boolean
(package private) final RollingCalendar
private long
protected static final long
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
ConstructorsConstructorDescriptionTimeBasedArchiveRemover
(FileNamePattern fileNamePattern, RollingCalendar rc) -
Method Summary
Modifier and TypeMethodDescription(package private) void
capTotalSize
(Date now) void
Future
<?> cleanAsynchronously
(Date now) void
cleanPeriod
(Date dateOfPeriodToClean) (package private) int
computeElapsedPeriodsSinceLastClean
(long nowInMillis) (package private) boolean
computeParentCleaningFlag
(FileNamePattern fileNamePattern) private void
descendingSortByLastModified
(File[] matchingFileArray) private boolean
fileExistsAndIsFile
(File file2Delete) protected File[]
getFilesInPeriod
(Date dateOfPeriodToClean) (package private) File
getParentDir
(File file) protected int
(package private) void
removeFolderIfEmpty
(File dir) private void
removeFolderIfEmpty
(File dir, int depth) Will remove the directory passed as parameter if empty.void
setMaxHistory
(int maxHistory) void
setTotalSizeCap
(long totalSizeCap) toString()
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
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
-
rc
-
maxHistory
private int maxHistory -
totalSizeCap
private long totalSizeCap -
parentClean
final boolean parentClean -
lastHeartBeat
long lastHeartBeat -
callCount
int callCount
-
-
Constructor Details
-
TimeBasedArchiveRemover
-
-
Method Details
-
clean
- Specified by:
clean
in interfaceArchiveRemover
-
getFilesInPeriod
-
fileExistsAndIsFile
-
cleanPeriod
-
capTotalSize
-
descendingSortByLastModified
-
getParentDir
-
computeElapsedPeriodsSinceLastClean
int computeElapsedPeriodsSinceLastClean(long nowInMillis) -
computeParentCleaningFlag
-
removeFolderIfEmpty
-
removeFolderIfEmpty
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 interfaceArchiveRemover
-
getPeriodOffsetForDeletionTarget
protected int getPeriodOffsetForDeletionTarget() -
setTotalSizeCap
public void setTotalSizeCap(long totalSizeCap) - Specified by:
setTotalSizeCap
in interfaceArchiveRemover
-
toString
-
cleanAsynchronously
- Specified by:
cleanAsynchronously
in interfaceArchiveRemover
-