Class TwoStreamsCache

java.lang.Object
com.atlassian.plugin.cache.filecache.impl.StreamsCache
com.atlassian.plugin.cache.filecache.impl.TwoStreamsCache

public class TwoStreamsCache extends StreamsCache
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