org.mapdb / HTreeMap


class HTreeMap<K, V> : ConcurrentMap<K, V>, ConcurrencyAware, MapExtra<K, V>, Verifiable, Closeable

Concurrent HashMap which uses IndexTree for hash table


KeySet class KeySet<K> : AbstractSet<K>


<init> HTreeMap(keySerializer: Serializer<K>, valueSerializer: Serializer<V>, valueInline: Boolean, concShift: Int, dirShift: Int, levels: Int, stores: Array<Store>, indexTrees: Array<<ERROR CLASS>>, hashSeed: Int, counterRecids: LongArray?, expireCreateTTL: Long, expireUpdateTTL: Long, expireGetTTL: Long, expireMaxSize: Long, expireStoreSize: Long, expireCreateQueues: Array<QueueLong>?, expireUpdateQueues: Array<QueueLong>?, expireGetQueues: Array<QueueLong>?, expireExecutor: ScheduledExecutorService?, expireExecutorPeriod: Long, expireCompactThreshold: Double?, isThreadSafe: Boolean, valueLoader: (K) -> V?, modificationListeners: Array<MapModificationListener<K, V>>?, closeable: Closeable?, hasValues: Boolean = true)

Concurrent HashMap which uses IndexTree for hash table


concShift val concShift: Int
counterRecids val counterRecids: LongArray?
dirShift val dirShift: Int
entries val entries: MutableSet<MutableEntry<K?, V?>>
expireCompactThreshold val expireCompactThreshold: Double?
expireCreateQueues val expireCreateQueues: Array<QueueLong>?
expireCreateTTL val expireCreateTTL: Long
expireExecutor val expireExecutor: ScheduledExecutorService?
expireExecutorPeriod val expireExecutorPeriod: Long
expireGetQueues val expireGetQueues: Array<QueueLong>?
expireGetTTL val expireGetTTL: Long
expireMaxSize val expireMaxSize: Long
expireStoreSize val expireStoreSize: Long
expireUpdateQueues val expireUpdateQueues: Array<QueueLong>?
expireUpdateTTL val expireUpdateTTL: Long
hasValues val hasValues: Boolean
indexTrees val indexTrees: Array<<ERROR CLASS>>
isForegroundEviction val isForegroundEviction: Boolean

true if Eviction is executed inside user thread, as part of get/put etc operations

isThreadSafe val isThreadSafe: Boolean

returns true if this is configured to be thread safe

keySerializer val keySerializer: Serializer<K>
keys val keys: KeySet<K>
leafSerializer val leafSerializer: Serializer<Array<Any>>
levels val levels: Int
locks val locks: Array<ReadWriteLock?>
size val size: Int
stores val stores: Array<Store>
valueInline val valueInline: Boolean
valueLoader val valueLoader: (K) -> V?
valueSerializer val valueSerializer: Serializer<V>
values val values: MutableCollection<V?>


calculateCollisionSize fun calculateCollisionSize(): <ERROR CLASS><Long, Long>

calculates number of collisions and total size of this set.

checkThreadSafe fun checkThreadSafe(): Unit

checks all subcomponents, if this component is really thread safe, and throws an exception if not thread safe

clear fun clear(): Unit
fun clear(notifyListeners: Int = 1): Unit
clear2 fun clear2(notifyListeners: Boolean = true): Unit
clearWithExpire fun clearWithExpire(): Unit

Removes all entries from this Map, and notifies listeners as if content has expired. This will cause expired content to overflow to secondary collections etc

clearWithoutNotification fun clearWithoutNotification(): Unit

Removes all entries from this Map, but does not notify modification listeners

close fun close(): Unit
containsKey fun containsKey(key: K?): Boolean
containsValue fun containsValue(value: V?): Boolean
equals fun equals(other: Any?): Boolean
expireEvict fun expireEvict(): Unit

releases old stuff from queue

expireEvictEntry fun expireEvictEntry(segment: Int, leafRecid: Long, nodeRecid: Long): Unit
expireEvictSegment fun expireEvictSegment(segment: Int): Unit
expireId fun expireId(nodeRecid: Long, queue: Long): Long
expireNodeRecidFor fun expireNodeRecidFor(expireId: Long): Long
expireQueueFor fun expireQueueFor(segment: Int, expireId: Long): QueueLong
forEach fun forEach(action: BiConsumer<in K, in V>): Unit
forEachKey fun forEachKey(action: (K) -> Unit): Unit
forEachValue fun forEachValue(action: (V) -> Unit): Unit
get fun get(key: K?): V?
getprotected fun getprotected(hash: Int, key: K, updateQueue: Boolean): V?
hash fun hash(key: K): Int
hashCode fun hashCode(): Int
hashToIndex fun hashToIndex(hash: Int): Long
hashToSegment fun hashToSegment(hash: Int): Int
htreeEntry fun htreeEntry(key: K, valueOrig: V): MutableEntry<K?, V?>
htreeIterator fun <E> htreeIterator(segment: Int, loadNext: (Any, Any) -> E): MutableIterator<E>
isClosed fun isClosed(): Boolean
isEmpty fun isEmpty(): Boolean
leafGet fun leafGet(store: Store, leafRecid: Long): Array<Any>
listenerNotify fun listenerNotify(key: K, oldValue: V?, newValue: V?, triggered: Boolean): Unit
put fun put(key: K?, value: V?): V?
putAll fun putAll(from: Map<out K?, V?>): Unit
putIfAbsent fun putIfAbsent(key: K?, value: V?): V?
putIfAbsentBoolean fun putIfAbsentBoolean(key: K?, value: V?): Boolean

Atomically associates the specified key with the given value if it is not already associated with a value.

putprotected fun putprotected(hash: Int, key: K, value: V, triggered: Boolean): V?
remove fun remove(key: K?): V?
fun remove(key: Any?, value: Any?): Boolean
removeprotected fun removeprotected(hash: Int, key: K, evicted: Boolean): V?
replace fun replace(key: K?, oldValue: V?, newValue: V?): Boolean
fun replace(key: K?, value: V?): V?
sizeLong fun sizeLong(): Long

map size as long number

valueUnwrap fun valueUnwrap(segment: Int, wrappedValue: Any): V
valueWrap fun valueWrap(segment: Int, value: V): Any
verify fun verify(): Unit

Companion Object Properties


Companion Object Functions

make fun <K, V> make(keySerializer: Serializer<K> = Serializer.ELSA as Serializer<K>, valueSerializer: Serializer<V> = Serializer.ELSA as Serializer<V>, valueInline: Boolean = false, concShift: Int = CC.HTREEMAP_CONC_SHIFT, dirShift: Int = CC.HTREEMAP_DIR_SHIFT, levels: Int = CC.HTREEMAP_LEVELS, stores: Array<Store> = Array(1.shl(concShift), {StoreTrivial()}), indexTrees: Array<<ERROR CLASS>> = Array(1.shl(concShift), { i->IndexTreeLongLongMap.make(stores[i], levels=levels, dirShift = dirShift)}), hashSeed: Int = SecureRandom().nextInt(), counterRecids: LongArray? = null, expireCreateTTL: Long = 0L, expireUpdateTTL: Long = 0L, expireGetTTL: Long = 0L, expireMaxSize: Long = 0L, expireStoreSize: Long = 0L, expireCreateQueues: Array<QueueLong>? = if(expireCreateTTL<=0L) null else Array(stores.size, { i->QueueLong.make(store = stores[i])}), expireUpdateQueues: Array<QueueLong>? = if(expireUpdateTTL<=0L) null else Array(stores.size, { i->QueueLong.make(store = stores[i])}), expireGetQueues: Array<QueueLong>? = if(expireGetTTL<=0L) null else Array(stores.size, { i->QueueLong.make(store = stores[i])}), expireExecutor: ScheduledExecutorService? = null, expireExecutorPeriod: Long = 0, expireCompactThreshold: Double? = null, isThreadSafe: Boolean = true, valueLoader: (K) -> V = null, modificationListeners: Array<MapModificationListener<K, V>>? = null, closeable: Closeable? = null): HTreeMap<K, V>

constructor with default values