Class OneStreamCache
java.lang.Object
com.atlassian.plugin.cache.filecache.impl.StreamsCache
com.atlassian.plugin.cache.filecache.impl.OneStreamCache
Caches the contents of a stream, and deletes the cache when asked to do so.
This class encapsulates the lifecycle of a cached file, 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) protected voidvoidstreamTwo(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
-
tmpFile
-
-
Constructor Details
-
OneStreamCache
-
-
Method Details
-
stream
- Specified by:
streamin classStreamsCache
-
streamTwo
- Specified by:
streamTwoin classStreamsCache
-
deleteWhenPossible
public void deleteWhenPossible()- Specified by:
deleteWhenPossiblein classStreamsCache
-
streamToCache
- Throws:
IOException
-