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
  • 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()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • execute

      public void execute()
    • executeAggressive

      public void executeAggressive(String reason, long targetReductionBytes)
    • execute

      public void execute(String reasonMessage)
    • handle

      public void handle(File cachedContentFile)
      Specified by:
      handle in interface FileHandler
    • 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(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 Date getTimeStarted()
    • getTimeFinished

      public Date getTimeFinished()
    • getDurationSeconds

      public long getDurationSeconds()
    • getDurationMillis

      public long getDurationMillis()
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • getCacheRoot

      public File getCacheRoot()
      Returns the cacheRoot that this cleaner is responsible for.
      Returns:
      File