com.atlassian.plugin.cache.filecache.impl
Class CachedFile

java.lang.Object
  extended by com.atlassian.plugin.cache.filecache.impl.CachedFile

public class CachedFile
extends Object

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:
v2.13

Constructor Summary
CachedFile(File tmpFile)
           
 
Method Summary
 void deleteWhenPossible()
           
 void stream(OutputStream dest, FileCacheStreamProvider input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedFile

public CachedFile(File tmpFile)
Method Detail

stream

public void stream(OutputStream dest,
                   FileCacheStreamProvider input)
            throws DownloadException
Throws:
DownloadException

deleteWhenPossible

public void deleteWhenPossible()


Copyright © 2013 Atlassian. All Rights Reserved.