public interface ChronicleHash<K,C extends net.openhft.chronicle.hash.KeyContext<K>,EQC extends ExternalHashQueryContext<K>> extends Closeable
ChronicleMap
and ChronicleSet
, related to off-heap
memory management and file-mapping. Not usable by itself.Modifier and Type | Method and Description |
---|---|
void |
close()
Releases the off-heap memory, used by this hash container and resources, used by replication,
if any.
|
C |
context(K key)
Deprecated.
use
queryContext(K) instead |
File |
file()
Returns the file this hash container mapped to, i.
|
void |
forEachEntry(Consumer<? super C> action)
Performs the given action for each entry in this
ChronicleHash until all entries have
been processed or the action throws an Exception . |
boolean |
forEachEntryWhile(Predicate<? super C> predicate)
Checks the given predicate on each entry in this
ChronicleHash until all entries
have been processed or the predicate returns false for some entry, or throws
an Exception . |
Class<K> |
keyClass() |
long |
longSize() |
EQC |
queryContext(K key) |
File file()
ChronicleHashBuilder.create()
call, or null
if it is purely in-memory,
i. e. if it is created by ChronicleHashBuilder.create()
call.ChronicleMap
or ChronicleSet
is mapped to,
or null
if it is not mapped to any fileChronicleHashBuilder.createPersistedTo(java.io.File)
long longSize()
@Deprecated C context(K key)
queryContext(K)
insteadboolean forEachEntryWhile(Predicate<? super C> predicate)
ChronicleHash
until all entries
have been processed or the predicate returns false
for some entry, or throws
an Exception
. Exceptions thrown by the predicate are relayed to the caller.
The order in which the entries will be processed is unspecified. It might differ from
the order of iteration via Iterator
returned by any method of this
ChronicleHash
or it's collection view.
If the ChronicleHash
is empty, this method returns true
immediately.
predicate
- the predicate to be checked for each entrytrue
if the predicate returned true
for all entries of
the ChronicleHash
, false
if it returned false
for the entryvoid forEachEntry(Consumer<? super C> action)
ChronicleHash
until all entries have
been processed or the action throws an Exception
. Exceptions thrown by the action are
relayed to the caller.
The order in which the entries will be processed is unspecified. It might differ from
the order of iteration via Iterator
returned by any method of this
ChronicleHash
or it's collection view.
action
- the action to be performed for each entryvoid close()
ChronicleMap
or ChronicleSet
instances mapping the same data.
If you won't call this method, memory would be held at least until next garbage
collection. This could be a problem if, for example, you target rare garbage collections,
but load and drop ChronicleHash
es regularly.
TODO what about commit guarantees, when ChronicleMap is used with memory-mapped files, if
ChronicleMap
/ChronicleSet
closed/not?
After this method call behaviour of all methods of ChronicleMap
or ChronicleSet
is undefined. Any method call on the map might throw
any exception, or even JVM crash. Shortly speaking, don't call use map closing.
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2015. All rights reserved.