Package 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
,AutoCloseable
- Enclosing class:
- StaticCache
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.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Cleaner.Cleanable
private boolean
private final String
private final StaticCache.State
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.FilterOutputStream
flush, write, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
state
-
cleanable
-
key
-
closed
private boolean closed
-
-
Constructor Details
-
LockSafeOutputStream
LockSafeOutputStream(OutputStream out, StaticCache.LockEntry lock)
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
toString
-