Class UnlockedHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.jboss.marshalling.reflect.UnlockedHashMap<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K, V>
Lock-free concurrent hash map.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class(package private) final class(package private) final class(package private) static final class(package private) final class(package private) final class(package private) final class(package private) static final class(package private) class(package private) final class(package private) final classNested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final floatprivate final intprivate final floatprivate static final intprivate static final ObjectA non-existent table entry (as opposed to anullvalue).private static final UnlockedHashMap.Item<?,?>[] A row which has been resized into the new view.private static final AtomicIntegerFieldUpdater<UnlockedHashMap.Table> private UnlockedHashMap.Table<K, V> private static final AtomicReferenceFieldUpdater<UnlockedHashMap, UnlockedHashMap.Table> private final Collection<V> private static final AtomicReferenceFieldUpdater<UnlockedHashMap.Item, Object> -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance.UnlockedHashMap(float loadFactor) Construct a new instance.UnlockedHashMap(int initialCapacity) Construct a new instance.UnlockedHashMap(int initialCapacity, float loadFactor) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate UnlockedHashMap.Item<K,V>[] addItem(UnlockedHashMap.Item<K, V>[] row, UnlockedHashMap.Item<K, V> newItem) voidclear()booleancontainsKey(Object key) private static <K,V> UnlockedHashMap.Item<K, V>[] createRow(int length) private static <K,V> UnlockedHashMap.Item<K, V>[] createRow(UnlockedHashMap.Item<K, V> newItem) private UnlockedHashMap<K,V>.TableIterator createRowIterator(UnlockedHashMap.Table<K, V> table, int rowIdx) private VdoGet(UnlockedHashMap.Table<K, V> table, K key) private Vprivate VdoRemove(K key, UnlockedHashMap.Table<K, V> table) private booleanprivate booleandoRemove(UnlockedHashMap.Item<K, V> item, UnlockedHashMap.Table<K, V> table) private Vprivate booleanentrySet()private static intkeySet()private static <V> VputIfAbsent(K key, V value) booleanprivate static <K,V> UnlockedHashMap.Item<K, V>[] remove(UnlockedHashMap.Item<K, V>[] row, int idx) booleanprivate voidresize(UnlockedHashMap.Table<K, V> origTable) private static <K,V> UnlockedHashMap.Item<K, V>[] resized()intsize()values()Methods inherited from class AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toStringMethods inherited from interface 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:
-
RESIZED
A row which has been resized into the new view. -
NONEXISTENT
A non-existent table entry (as opposed to anullvalue). -
table
-
keySet
-
entrySet
-
values
-
loadFactor
private final float loadFactor -
initialCapacity
private final int initialCapacity -
sizeUpdater
-
tableUpdater
private static final AtomicReferenceFieldUpdater<UnlockedHashMap, UnlockedHashMap.Table> tableUpdater -
valueUpdater
-
-
Constructor Details
-
UnlockedHashMap
public UnlockedHashMap(int initialCapacity, float loadFactor) Construct a new instance.- Parameters:
initialCapacity- the initial capacityloadFactor- the load factor
-
UnlockedHashMap
public UnlockedHashMap(float loadFactor) Construct a new instance.- Parameters:
loadFactor- the load factor
-
UnlockedHashMap
public UnlockedHashMap(int initialCapacity) Construct a new instance.- Parameters:
initialCapacity- the initial capacity
-
UnlockedHashMap
public UnlockedHashMap()Construct a new instance.
-
-
Method Details
-
addItem
private UnlockedHashMap.Item<K,V>[] addItem(UnlockedHashMap.Item<K, V>[] row, UnlockedHashMap.Item<K, V> newItem) -
createRow
-
createRow
-
doPut
-
hashCode
-
resize
-
remove
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
doRemove
-
doRemove
-
remove
-
doRemove
-
nonexistent
private static <V> V nonexistent() -
resized
-
replace
-
doReplace
-
replace
-
doReplace
-
size
-
doGet
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
get
-
put
-
clear
-
entrySet
-
values
-
keySet
-
createRowIterator
private UnlockedHashMap<K,V>.TableIterator createRowIterator(UnlockedHashMap.Table<K, V> table, int rowIdx)
-