Class StreamsCache

java.lang.Object
com.atlassian.plugin.cache.filecache.impl.StreamsCache
Direct Known Subclasses:
OneStreamCache, TwoStreamsCache

public abstract class StreamsCache extends Object
Base class for caching streams, mostly contains concurrency related logic, the file operations implemented in children.
Since:
v3.3
  • Constructor Details

    • StreamsCache

      public StreamsCache()
  • Method Details

    • streamFromFile

      public static void streamFromFile(File file, OutputStream out)
    • deleteWhenPossible

      public void deleteWhenPossible(Runnable callback)
    • stream

      public abstract void stream(OutputStream out, Cache.StreamProvider provider)
    • streamTwo

      public abstract void streamTwo(OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider)
    • deleteWhenPossible

      public abstract void deleteWhenPossible()
    • doEnter

      protected boolean doEnter(Runnable streamCallback, BooleanSupplier checkFilesCallback)
      Increments the concurrent count, and returns if it is okay to read from the cached file, or not. If necessary, it will create the cached file first. doExit() must be called iff this method returns normally
    • doExit

      protected void doExit(Runnable callback)
      Decrements the concurrent count. Will delete the cache if requested, and there are no other concurrent users.
    • createWriteStream

      protected OutputStream createWriteStream(File file) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • setLogger

      public void setLogger(org.slf4j.Logger log)
      Needed for tests.