public class HTreeMap<K,V> implements ConcurrencyAware, MapExtra<K,V>, Verifiable
Concurrent HashMap which uses IndexTree for hash table
Modifier and Type | Class and Description |
---|---|
static class |
HTreeMap.Companion |
static class |
HTreeMap.KeySet<K> |
ConcurrencyAware.DefaultImpls
Modifier and Type | Field and Description |
---|---|
static HTreeMap.Companion |
Companion |
Constructor and Description |
---|
HTreeMap(Serializer<K> keySerializer,
Serializer<V> valueSerializer,
boolean valueInline,
int concShift,
int dirShift,
int levels,
Store[] stores,
NonExistentClass[] indexTrees,
int hashSeed,
long[] counterRecids,
long expireCreateTTL,
long expireUpdateTTL,
long expireGetTTL,
long expireMaxSize,
long expireStoreSize,
QueueLong[] expireCreateQueues,
QueueLong[] expireUpdateQueues,
QueueLong[] expireGetQueues,
java.util.concurrent.ScheduledExecutorService expireExecutor,
long expireExecutorPeriod,
java.lang.Double expireCompactThreshold,
boolean isThreadSafe,
Function1<? super K,? extends V> valueLoader,
MapModificationListener<K,V>[] modificationListeners,
java.io.Closeable closeable,
boolean hasValues)
Concurrent HashMap which uses IndexTree for hash table
|
Modifier and Type | Method and Description |
---|---|
NonExistentClass |
calculateCollisionSize()
calculates number of collisions and total size of this set.
|
void |
checkThreadSafe()
checks all subcomponents, if this component is really thread safe, and throws an exception if not thread safe
|
void |
clear() |
void |
clear(int notifyListeners) |
void |
clear2(boolean notifyListeners)
Deprecated.
|
void |
clearWithExpire()
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
|
void |
clearWithoutNotification()
Removes all entries from this Map, but does not notify modification listeners
|
void |
close() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set |
entrySet() |
boolean |
equals(java.lang.Object other) |
void |
expireEvict()
releases old stuff from queue
|
void |
expireEvictEntry(int segment,
long leafRecid,
long nodeRecid) |
void |
expireEvictSegment(int segment) |
long |
expireId(long nodeRecid,
long queue) |
long |
expireNodeRecidFor(long expireId) |
QueueLong |
expireQueueFor(int segment,
long expireId) |
void |
forEach(java.util.function.BiConsumer<? super K,? super V> action) |
void |
forEachKey(Function1<? super K,Unit> action) |
void |
forEachValue(Function1<? super V,Unit> action) |
V |
get(java.lang.Object key) |
int |
getConcShift() |
long[] |
getCounterRecids() |
int |
getDirShift() |
java.util.Set<java.util.Map.Entry> |
getEntries() |
java.lang.Double |
getExpireCompactThreshold() |
QueueLong[] |
getExpireCreateQueues() |
long |
getExpireCreateTTL() |
java.util.concurrent.ScheduledExecutorService |
getExpireExecutor() |
long |
getExpireExecutorPeriod() |
QueueLong[] |
getExpireGetQueues() |
long |
getExpireGetTTL() |
long |
getExpireMaxSize() |
long |
getExpireStoreSize() |
QueueLong[] |
getExpireUpdateQueues() |
long |
getExpireUpdateTTL() |
boolean |
getHasValues() |
NonExistentClass[] |
getIndexTrees() |
Serializer<K> |
getKeySerializer() |
HTreeMap.KeySet<K> |
getKeys() |
Serializer<kotlin.Array[]> |
getLeafSerializer() |
int |
getLevels() |
java.util.concurrent.locks.ReadWriteLock[] |
getLocks() |
int |
getSize() |
Store[] |
getStores() |
boolean |
getValueInline() |
Function1<K,V> |
getValueLoader() |
Serializer<V> |
getValueSerializer() |
java.util.Collection<V> |
getValues() |
V |
getprotected(int hash,
K key,
boolean updateQueue) |
int |
hash(K key) |
int |
hashCode() |
long |
hashToIndex(int hash) |
int |
hashToSegment(int hash) |
java.util.Map.Entry<K,V> |
htreeEntry(K key,
V valueOrig) |
<E> java.util.Iterator<E> |
htreeIterator(int segment,
Function2<java.lang.Object,java.lang.Object,? extends E> loadNext) |
boolean |
isClosed() |
boolean |
isEmpty() |
boolean |
isForegroundEviction()
true if Eviction is executed inside user thread, as part of get/put etc operations
|
boolean |
isThreadSafe()
returns true if this is configured to be thread safe
|
java.util.Set |
keySet() |
java.lang.Object[] |
leafGet(Store store,
long leafRecid) |
void |
listenerNotify(K key,
V oldValue,
V newValue,
boolean triggered) |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> from) |
V |
putIfAbsent(K key,
V value) |
boolean |
putIfAbsentBoolean(K key,
V value)
Atomically associates the specified key with the given value if it is
not already associated with a value.
|
V |
putprotected(int hash,
K key,
V value,
boolean triggered) |
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
V |
removeprotected(int hash,
K key,
boolean evicted) |
boolean |
replace(K key,
V oldValue,
V newValue) |
V |
replace(K key,
V value) |
int |
size() |
long |
sizeLong()
map size as long number
|
V |
valueUnwrap(int segment,
java.lang.Object wrappedValue) |
java.lang.Object |
valueWrap(int segment,
V value) |
java.util.Collection |
values() |
void |
verify() |
checkThreadSafe, isThreadSafe
forEach, forEachKey, forEachValue, getKeySerializer, getValueSerializer, isClosed, putIfAbsentBoolean, sizeLong
verify
public static HTreeMap.Companion Companion
public HTreeMap(Serializer<K> keySerializer, Serializer<V> valueSerializer, boolean valueInline, int concShift, int dirShift, int levels, Store[] stores, NonExistentClass[] indexTrees, int hashSeed, long[] counterRecids, long expireCreateTTL, long expireUpdateTTL, long expireGetTTL, long expireMaxSize, long expireStoreSize, QueueLong[] expireCreateQueues, QueueLong[] expireUpdateQueues, QueueLong[] expireGetQueues, java.util.concurrent.ScheduledExecutorService expireExecutor, long expireExecutorPeriod, java.lang.Double expireCompactThreshold, boolean isThreadSafe, Function1<? super K,? extends V> valueLoader, MapModificationListener<K,V>[] modificationListeners, java.io.Closeable closeable, boolean hasValues)
Concurrent HashMap which uses IndexTree for hash table
isThreadSafe
- returns true if this is configured to be thread safepublic java.util.concurrent.locks.ReadWriteLock[] getLocks()
public boolean isForegroundEviction()
true if Eviction is executed inside user thread, as part of get/put etc operations
public Serializer<kotlin.Array[]> getLeafSerializer()
public int hash(K key)
public long hashToIndex(int hash)
public int hashToSegment(int hash)
public V put(K key, V value)
public V putprotected(int hash, K key, V value, boolean triggered)
public void putAll(java.util.Map<? extends K,? extends V> from)
public V remove(java.lang.Object key)
public V removeprotected(int hash, K key, boolean evicted)
public void clear()
public void clear2(boolean notifyListeners)
public void clearWithoutNotification()
Removes all entries from this Map, but does not notify modification listeners
public void clearWithExpire()
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
public void clear(int notifyListeners)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public V get(java.lang.Object key)
public V getprotected(int hash, K key, boolean updateQueue)
public boolean isEmpty()
public int getSize()
public int size()
public long sizeLong()
map size as long number
public V putIfAbsent(K key, V value)
public boolean putIfAbsentBoolean(K key, V value)
Atomically associates the specified key with the given value if it is not already associated with a value.
This is equivalent to:
if(cache.containsKey(key)){}cache.put(key,value);return true;}else{return false;}
*
except that the action is performed atomically.
public boolean remove(java.lang.Object key, java.lang.Object value)
public boolean replace(K key, V oldValue, V newValue)
public V replace(K key, V value)
public long expireNodeRecidFor(long expireId)
public QueueLong expireQueueFor(int segment, long expireId)
public long expireId(long nodeRecid, long queue)
public void expireEvict()
releases old stuff from queue
public void expireEvictSegment(int segment)
public void expireEvictEntry(int segment, long leafRecid, long nodeRecid)
public java.util.Set<java.util.Map.Entry> getEntries()
public java.util.Set entrySet()
public HTreeMap.KeySet<K> getKeys()
public java.util.Set keySet()
public java.util.Collection<V> getValues()
public java.util.Collection values()
public <E> java.util.Iterator<E> htreeIterator(int segment, Function2<java.lang.Object,java.lang.Object,? extends E> loadNext)
public java.util.Map.Entry<K,V> htreeEntry(K key, V valueOrig)
public int hashCode()
public boolean equals(java.lang.Object other)
public boolean isClosed()
public void listenerNotify(K key, V oldValue, V newValue, boolean triggered)
public V valueUnwrap(int segment, java.lang.Object wrappedValue)
public java.lang.Object valueWrap(int segment, V value)
public void forEach(java.util.function.BiConsumer<? super K,? super V> action)
public void forEachKey(Function1<? super K,Unit> action)
public void forEachValue(Function1<? super V,Unit> action)
public void verify()
public void close()
public void checkThreadSafe()
checks all subcomponents, if this component is really thread safe, and throws an exception if not thread safe
public NonExistentClass calculateCollisionSize()
calculates number of collisions and total size of this set.
public java.lang.Object[] leafGet(Store store, long leafRecid)
public Serializer<K> getKeySerializer()
public Serializer<V> getValueSerializer()
public boolean getValueInline()
public int getConcShift()
public int getDirShift()
public int getLevels()
public Store[] getStores()
public NonExistentClass[] getIndexTrees()
public long[] getCounterRecids()
public long getExpireCreateTTL()
public long getExpireUpdateTTL()
public long getExpireGetTTL()
public long getExpireMaxSize()
public long getExpireStoreSize()
public QueueLong[] getExpireCreateQueues()
public QueueLong[] getExpireUpdateQueues()
public QueueLong[] getExpireGetQueues()
public java.util.concurrent.ScheduledExecutorService getExpireExecutor()
public long getExpireExecutorPeriod()
public java.lang.Double getExpireCompactThreshold()
public boolean isThreadSafe()
returns true if this is configured to be thread safe
public Function1<K,V> getValueLoader()
public boolean getHasValues()