Package org.jboss.marshalling.reflect
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 class
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final float
private final int
private final float
private static final int
private static final Object
A non-existent table entry (as opposed to anull
value).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) void
clear()
boolean
containsKey
(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 V
doGet
(UnlockedHashMap.Table<K, V> table, K key) private V
private V
doRemove
(K key, UnlockedHashMap.Table<K, V> table) private boolean
private boolean
doRemove
(UnlockedHashMap.Item<K, V> item, UnlockedHashMap.Table<K, V> table) private V
private boolean
entrySet()
private static int
keySet()
private static <V> V
putIfAbsent
(K key, V value) boolean
private static <K,
V> UnlockedHashMap.Item<K, V>[] remove
(UnlockedHashMap.Item<K, V>[] row, int idx) boolean
private void
resize
(UnlockedHashMap.Table<K, V> origTable) private static <K,
V> UnlockedHashMap.Item<K, V>[] resized()
int
size()
values()
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
-
RESIZED
A row which has been resized into the new view. -
NONEXISTENT
A non-existent table entry (as opposed to anull
value). -
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:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
doRemove
-
doRemove
-
remove
-
doRemove
-
nonexistent
private static <V> V nonexistent() -
resized
-
replace
-
doReplace
-
replace
-
doReplace
-
size
public int size() -
doGet
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
put
-
clear
public void clear() -
entrySet
-
values
-
keySet
-
createRowIterator
private UnlockedHashMap<K,V>.TableIterator createRowIterator(UnlockedHashMap.Table<K, V> table, int rowIdx)
-