Package org.jboss.modules
Class UnlockedReadHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.jboss.modules.UnlockedReadHashMap<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,V>
A hash map that supports non-blocking, lockless read access.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate final classprivate static final classNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final floatprivate final floatprivate static final intprivate intprivate AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> private intprivate final Object -
Constructor Summary
ConstructorsConstructorDescriptionUnlockedReadHashMap(float loadFactor) UnlockedReadHashMap(int initialCapacity) UnlockedReadHashMap(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) private static <K,V> UnlockedReadHashMap.Item <K, V> doGet(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) private static <K,V> UnlockedReadHashMap.Item <K, V> doGet(UnlockedReadHashMap.Item<K, V>[] row, Object key) private static <K,V> UnlockedReadHashMap.Item<K, V>[] doGetRow(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, int hc) private static <K,V> UnlockedReadHashMap.Item<K, V>[] doGetRow(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) private VdoPut(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, K key, V value, boolean ifAbsent) entrySet()private static <K,V> int getIndex(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) putIfAbsent(K key, V value) booleanprivate static <K,V> UnlockedReadHashMap.Item<K, V>[] remove(UnlockedReadHashMap.Item<K, V>[] row, int idx) booleanprivate voidresize()intsize()Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Field Details
-
DEFAULT_INITIAL_CAPACITY
private static final int DEFAULT_INITIAL_CAPACITY- See Also:
-
MAXIMUM_CAPACITY
private static final int MAXIMUM_CAPACITY- See Also:
-
DEFAULT_LOAD_FACTOR
private static final float DEFAULT_LOAD_FACTOR- See Also:
-
writeLock
-
entrySet
-
loadFactor
private final float loadFactor -
size
private volatile int size -
table
-
threshold
private int threshold
-
-
Constructor Details
-
UnlockedReadHashMap
UnlockedReadHashMap(int initialCapacity, float loadFactor) -
UnlockedReadHashMap
UnlockedReadHashMap(float loadFactor) -
UnlockedReadHashMap
UnlockedReadHashMap(int initialCapacity) -
UnlockedReadHashMap
UnlockedReadHashMap()
-
-
Method Details
-
resize
private void resize() -
doGet
private static <K,V> UnlockedReadHashMap.Item<K,V> doGet(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) -
doGetRow
private static <K,V> UnlockedReadHashMap.Item<K,V>[] doGetRow(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) -
getIndex
private static <K,V> int getIndex(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, Object key) -
doGetRow
private static <K,V> UnlockedReadHashMap.Item<K,V>[] doGetRow(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, int hc) -
doGet
private static <K,V> UnlockedReadHashMap.Item<K,V> doGet(UnlockedReadHashMap.Item<K, V>[] row, Object key) -
doPut
private V doPut(AtomicReferenceArray<UnlockedReadHashMap.Item<K, V>[]> table, K key, V value, boolean ifAbsent) -
remove
private static <K,V> UnlockedReadHashMap.Item<K,V>[] remove(UnlockedReadHashMap.Item<K, V>[] row, int idx) -
entrySet
-
size
public int size() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
put
-
remove
-
clear
public void clear() -
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
replace
-
replace
-