Interface IFileCleaner

  • All Known Implementing Classes:
    FileCleaner

    public interface IFileCleaner
    Keeps track of files awaiting deletion, and deletes them when an associated marker object is reclaimed by the garbage collector.

    Needed to remove files created temporarily for the needs of FileUpload functionality.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void destroy()
      Call this method to stop the cleaner and to free all allocated resources by it
      void track​(File file, Object marker)
      Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.
      void track​(File file, Object marker, org.apache.commons.io.FileDeleteStrategy deleteStrategy)
      Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.
    • Method Detail

      • track

        void track​(File file,
                   Object marker)
        Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.
        Parameters:
        file - the file to be tracked, not null
        marker - the marker object used to track the file, not null
        Throws:
        NullPointerException - if the file is null
      • track

        void track​(File file,
                   Object marker,
                   org.apache.commons.io.FileDeleteStrategy deleteStrategy)
        Track the specified file, using the provided marker, deleting the file when the marker instance is garbage collected.
        Parameters:
        file - the file to be tracked, not null
        marker - the marker object used to track the file, not null
        deleteStrategy - the strategy that actually deletes the file. E.g. to delete a non-empty folder the strategy should delete all children first
        Throws:
        NullPointerException - if the file is null
      • destroy

        void destroy()
        Call this method to stop the cleaner and to free all allocated resources by it