net.sf.basedb.util
Class StaticCache.LockSafeOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.sf.basedb.util.StaticCache.LockSafeOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- Enclosing class:
- StaticCache
static class StaticCache.LockSafeOutputStream
- extends FilterOutputStream
A lock-safe output stream that releases the associated
write lock when the stream is closed.
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.
calledFrom
private final Throwable calledFrom
lock
private ReadWriteLock lock
key
private String key
closed
private boolean closed
StaticCache.LockSafeOutputStream
StaticCache.LockSafeOutputStream(OutputStream out,
StaticCache.LockEntry lock)
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class FilterOutputStream
- Throws:
IOException
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize
in class Object
- Throws:
Throwable
toString
public String toString()
- Overrides:
toString
in class Object