Class CachedContentCleaner
java.lang.Object
java.lang.Thread
org.alfresco.repo.content.caching.cleanup.CachedContentCleaner
- All Implemented Interfaces:
Runnable,FileHandler,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware
public class CachedContentCleaner
extends 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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()voidvoidexecuteAggressive(String reason, long targetReductionBytes) Returns the cacheRoot that this cleaner is responsible for.longlonglonglonglonglongdoublevoidvoidinit()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.booleanvoidrun()voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher) voidsetCache(ContentCacheImpl cache) voidsetMaxDeleteWatchCount(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
-
Constructor Details
-
CachedContentCleaner
public CachedContentCleaner()
-
-
Method Details
-
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() -
execute
public void execute() -
executeAggressive
-
execute
-
handle
- Specified by:
handlein interfaceFileHandler
-
setCache
-
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
Sets the maxDeleteWatchCount value.- Parameters:
maxDeleteWatchCount- Integer- See Also:
-
markOrDelete(File, CacheFileProps)
-
setUsageTracker
- 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
-
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
Returns the cacheRoot that this cleaner is responsible for.- Returns:
- File
-