Class StreamsCache
java.lang.Object
com.atlassian.plugin.cache.filecache.impl.StreamsCache
- Direct Known Subclasses:
OneStreamCache,TwoStreamsCache
Base class for caching streams, mostly contains concurrency related logic, the file operations implemented
in children.
- Since:
- v3.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OutputStreamcreateWriteStream(File file) abstract voidvoiddeleteWhenPossible(Runnable callback) protected booleandoEnter(Runnable streamCallback, BooleanSupplier checkFilesCallback) Increments the concurrent count, and returns if it is okay to read from the cached file, or not.protected voidDecrements the concurrent count.voidsetLogger(org.slf4j.Logger log) Needed for tests.abstract voidstream(OutputStream out, Cache.StreamProvider provider) static voidstreamFromFile(File file, OutputStream out) abstract voidstreamTwo(OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider)
-
Constructor Details
-
StreamsCache
public StreamsCache()
-
-
Method Details
-
streamFromFile
-
deleteWhenPossible
-
stream
-
streamTwo
public abstract void streamTwo(OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider) -
deleteWhenPossible
public abstract void deleteWhenPossible() -
doEnter
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
Decrements the concurrent count. Will delete the cache if requested, and there are no other concurrent users. -
createWriteStream
- Throws:
FileNotFoundException
-
setLogger
public void setLogger(org.slf4j.Logger log) Needed for tests.
-