Class AttachmentCacheMonitor


  • public final class AttachmentCacheMonitor
    extends Object
    The CacheMonitor is responsible for deleting temporary attachment files after a timeout period has expired. The register method is invoked when the attachment file is created. The access method is invoked whenever the attachment file is accessed. The checkForAgedFiles method is invoked whenever the monitor should look for files to cleanup (delete).
    • Method Detail

      • getAttachmentCacheMonitor

        public static AttachmentCacheMonitor getAttachmentCacheMonitor()
        Get or Create an AttachmentCacheMonitor singleton
        Returns:
        the singleton instance
      • getTimeout

        public int getTimeout()
        Returns:
        timeout value in seconds
      • setTimeout

        public void setTimeout​(int timeout)
        This method should Set a new timeout value
        Parameters:
        timeout - new timeout value in seconds
      • register

        public void register​(String fileName)
        Register a file name with the monitor. This will allow the Monitor to remove the file after the timeout period.
        Parameters:
        fileName -
      • access

        public void access​(String fileName)
        Indicates that the file was accessed.
        Parameters:
        fileName -
      • checkForAgedFiles

        public void checkForAgedFiles()
        Check for aged files and remove the aged ones.