Package io.permazen.kv.util
Class CloseableForwardingKVStore
java.lang.Object
io.permazen.kv.util.ForwardingKVStore
io.permazen.kv.util.CloseableForwardingKVStore
- All Implemented Interfaces:
CloseableKVStore
,KVStore
,Closeable
,AutoCloseable
- Direct Known Subclasses:
CachingKVStore
A
ForwardingKVStore
also implementing CloseableKVStore
, with some associated
underlying Closeable
resource to close when close()
'd.-
Constructor Summary
ConstructorDescriptionCloseableForwardingKVStore
(KVStore kvstore, Runnable closeAction) Constructor. -
Method Summary
Methods inherited from class io.permazen.kv.util.ForwardingKVStore
adjustCounter, apply, decodeCounter, encodeCounter, get, getAtLeast, getAtMost, getRange, put, remove, removeRange
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.permazen.kv.KVStore
adjustCounter, apply, decodeCounter, encodeCounter, get, getAtLeast, getAtMost, getRange, getRange, getRange, put, remove, removeRange, removeRange
-
Constructor Details
-
CloseableForwardingKVStore
Constructor.- Parameters:
kvstore
- key/value store for forwardingcloseAction
- action to perform onclose()
, or null for none- Throws:
IllegalArgumentException
- ifkvstore
is null
-
-
Method Details
-
delegate
Description copied from class:ForwardingKVStore
Get the underlyingKVStore
.- Specified by:
delegate
in classForwardingKVStore
- Returns:
- underlying
KVStore
-
close
public void close()Description copied from interface:CloseableKVStore
Close thisKVStore
and release any resources associated with it.If this instance is already closed, then nothing happens.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableKVStore
-
finalize
Ensure the associated resource isclose()
'd before reclaiming memory.
-