Class CachedContentCleaner
- java.lang.Object
-
- java.lang.Thread
-
- org.alfresco.repo.content.caching.cleanup.CachedContentCleaner
-
- All Implemented Interfaces:
java.lang.Runnable,FileHandler,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware
public class CachedContentCleaner extends java.lang.Thread implements FileHandler, org.springframework.context.ApplicationEventPublisherAware
Cleans up redundant cache files from the cached content file store. Once references to cache files are no longer in the in-memory cache, the binary content files can be removed.- Author:
- Matt Ward
-
-
Constructor Summary
Constructors Constructor Description CachedContentCleaner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()voidexecute(java.lang.String reasonMessage)voidexecuteAggressive(java.lang.String reason, long targetReductionBytes)java.io.FilegetCacheRoot()Returns the cacheRoot that this cleaner is responsible for.longgetDurationMillis()longgetDurationSeconds()longgetNumFilesDeleted()longgetNumFilesMarked()longgetNumFilesSeen()longgetSizeFilesDeleted()doublegetSizeFilesDeletedMB()java.util.DategetTimeFinished()java.util.DategetTimeStarted()voidhandle(java.io.File cachedContentFile)voidinit()This method MUST be called after the cleaner has been fully constructed to notify interested parties that the cleaner exists and to start the actual cleaner thread.booleanisRunning()voidrun()voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)voidsetCache(ContentCacheImpl cache)voidsetMaxDeleteWatchCount(java.lang.Integer maxDeleteWatchCount)Sets the maxDeleteWatchCount value.voidsetMinFileAgeMillis(long minFileAgeMillis)Sets the minimum age of a cache file before it will be considered for deletion.voidsetUsageTracker(UsageTracker usageTracker)-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
init
public void init()
This method MUST be called after the cleaner has been fully constructed to notify interested parties that the cleaner exists and to start the actual cleaner thread.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
execute
public void execute()
-
executeAggressive
public void executeAggressive(java.lang.String reason, long targetReductionBytes)
-
execute
public void execute(java.lang.String reasonMessage)
-
handle
public void handle(java.io.File cachedContentFile)
- Specified by:
handlein interfaceFileHandler
-
setCache
public void setCache(ContentCacheImpl cache)
-
setMinFileAgeMillis
public void setMinFileAgeMillis(long minFileAgeMillis)
Sets the minimum age of a cache file before it will be considered for deletion.- Parameters:
minFileAgeMillis- long- See Also:
oldEnoughForCleanup(File)
-
setMaxDeleteWatchCount
public void setMaxDeleteWatchCount(java.lang.Integer maxDeleteWatchCount)
Sets the maxDeleteWatchCount value.- Parameters:
maxDeleteWatchCount- Integer- See Also:
markOrDelete(File, CacheFileProps)
-
setUsageTracker
public void setUsageTracker(UsageTracker usageTracker)
- Parameters:
usageTracker- the usageTracker to set
-
isRunning
public boolean isRunning()
-
getNumFilesSeen
public long getNumFilesSeen()
-
getNumFilesDeleted
public long getNumFilesDeleted()
-
getSizeFilesDeleted
public long getSizeFilesDeleted()
-
getSizeFilesDeletedMB
public double getSizeFilesDeletedMB()
-
getNumFilesMarked
public long getNumFilesMarked()
-
getTimeStarted
public java.util.Date getTimeStarted()
-
getTimeFinished
public java.util.Date getTimeFinished()
-
getDurationSeconds
public long getDurationSeconds()
-
getDurationMillis
public long getDurationMillis()
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
getCacheRoot
public java.io.File getCacheRoot()
Returns the cacheRoot that this cleaner is responsible for.- Returns:
- File
-
-