public class TwoStreamsCache extends StreamsCache
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.
StreamsCache.Callback, StreamsCache.CallbackWithBooleanReturn| Modifier and Type | Field and Description |
|---|---|
protected File |
tmpFile1 |
protected File |
tmpFile2 |
| Constructor and Description |
|---|
TwoStreamsCache(File tmpFile1,
File tmpFile2) |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteWhenPossible() |
void |
stream(OutputStream out,
Cache.StreamProvider provider) |
void |
streamTwo(OutputStream out1,
OutputStream out2,
Cache.TwoStreamProvider provider) |
createWriteStream, deleteWhenPossible, doEnter, doExit, setLogger, streamFromFilepublic void streamTwo(OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider)
streamTwo in class StreamsCachepublic void stream(OutputStream out, Cache.StreamProvider provider)
stream in class StreamsCachepublic void deleteWhenPossible()
deleteWhenPossible in class StreamsCacheCopyright © 2017 Atlassian. All rights reserved.