Class TwoStreamsCache
java.lang.Object
com.atlassian.plugin.cache.filecache.impl.StreamsCache
com.atlassian.plugin.cache.filecache.impl.TwoStreamsCache
Caches the contents of two streams, and deletes the cache when asked to do so.
This class encapsulates the lifecycle of two cached files, from as-yet-uncached, to cached, to needs-deletion, to deleted.
Calls to stream() always succeed, even if the cache was deleted. The initial call to stream() will block other callers to stream() and deleteWhenPossible().
Subsequent calls to stream() don't block other calls.
Subsequent calls to deleteWhenPossible() don't block.
A call to deleteWhenPossible() always results in the file being (eventually) deleted.
Both stream() and deleteWhenPossible() can be called multiple times, in any order, with any level of concurrency.
- Since:
- v3.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidstream(OutputStream out, Cache.StreamProvider provider) voidstreamTwo(OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider) Methods inherited from class com.atlassian.plugin.cache.filecache.impl.StreamsCache
createWriteStream, deleteWhenPossible, doEnter, doExit, setLogger, streamFromFile
-
Field Details
-
tmpFile1
-
tmpFile2
-
-
Constructor Details
-
TwoStreamsCache
-
-
Method Details
-
streamTwo
- Specified by:
streamTwoin classStreamsCache
-
stream
- Specified by:
streamin classStreamsCache
-
deleteWhenPossible
public void deleteWhenPossible()- Specified by:
deleteWhenPossiblein classStreamsCache
-