static class StaticCache.LockSafeOutputStream extends FilterOutputStream
NOTE! It is important that we keep a strong reference to the 'key' in this class until the stream is closed, since otherwise the locked entry may be reclaimed by the garbage collector.
Modifier and Type | Field and Description |
---|---|
private Throwable |
calledFrom |
private boolean |
closed |
private String |
key |
private ReadWriteLock |
lock |
out
Constructor and Description |
---|
LockSafeOutputStream(OutputStream out,
StaticCache.LockEntry lock) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
String |
toString() |
flush, write, write, write
private final Throwable calledFrom
private ReadWriteLock lock
private String key
private boolean closed
LockSafeOutputStream(OutputStream out, StaticCache.LockEntry lock)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
protected void finalize() throws Throwable