Package net.sf.basedb.util
Class StaticCache.LockSafeInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.sf.basedb.util.StaticCache.LockSafeInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
- StaticCache
A lock-safe input stream that releases the associated
read 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.FilterInputStream
in
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
state
-
cleanable
-
key
-
closed
private boolean closed
-
-
Constructor Details
-
LockSafeInputStream
LockSafeInputStream(InputStream in, StaticCache.LockEntry lock)
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
toString
-