Package org.apache.hadoop.hbase.types
Class CopyOnWriteArrayMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.hadoop.hbase.types.CopyOnWriteArrayMap<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,
,V> ConcurrentNavigableMap<K,
,V> Map<K,
,V> NavigableMap<K,
,V> SortedMap<K,
V>
@Private
@Stable
public class CopyOnWriteArrayMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, ConcurrentNavigableMap<K,V>
A Map that keeps a sorted array in order to provide the concurrent map interface. Keeping a
sorted array means that it's much more cache line friendly, making reads faster than the tree
version. In order to make concurrent reads and writes safe this does a copy on write. There can
only be one concurrent write at a time.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
private final class
private static final class
private static final class
private final class
private final class
private static final class
private static 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
Modifier and TypeFieldDescriptionprivate CopyOnWriteArrayMap.ArrayHolder<K,
V> private final Comparator<? super K>
-
Constructor Summary
ModifierConstructorDescriptionCopyOnWriteArrayMap
(Comparator<? super K> keyComparator) private
CopyOnWriteArrayMap
(Comparator<? super K> keyComparator, CopyOnWriteArrayMap.ArrayHolder<K, V> holder) -
Method Summary
Modifier and TypeMethodDescriptionceilingEntry
(K key) ceilingKey
(K key) void
clear()
Comparator<? super K>
boolean
containsKey
(Object key) entrySet()
firstKey()
floorEntry
(K key) higherEntry
(K key) boolean
isEmpty()
keySet()
lastKey()
lowerEntry
(K key) putIfAbsent
(K key, V value) boolean
boolean
int
size()
values()
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, 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
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, putAll
-
Field Details
-
keyComparator
-
holder
-
-
Constructor Details
-
CopyOnWriteArrayMap
public CopyOnWriteArrayMap() -
CopyOnWriteArrayMap
-
CopyOnWriteArrayMap
private CopyOnWriteArrayMap(Comparator<? super K> keyComparator, CopyOnWriteArrayMap.ArrayHolder<K, V> holder)
-
-
Method Details
-
comparator
- Specified by:
comparator
in interfaceSortedMap<K,
V>
-
tailMap
- Specified by:
tailMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
tailMap
in interfaceNavigableMap<K,
V>
-
tailMap
-
firstKey
-
lastKey
-
lowerEntry
- Specified by:
lowerEntry
in interfaceNavigableMap<K,
V>
-
lowerKey
- Specified by:
lowerKey
in interfaceNavigableMap<K,
V>
-
floorEntry
- Specified by:
floorEntry
in interfaceNavigableMap<K,
V>
-
floorKey
- Specified by:
floorKey
in interfaceNavigableMap<K,
V>
-
ceilingEntry
- Specified by:
ceilingEntry
in interfaceNavigableMap<K,
V>
-
ceilingKey
- Specified by:
ceilingKey
in interfaceNavigableMap<K,
V>
-
higherEntry
- Specified by:
higherEntry
in interfaceNavigableMap<K,
V>
-
higherKey
- Specified by:
higherKey
in interfaceNavigableMap<K,
V>
-
firstEntry
- Specified by:
firstEntry
in interfaceNavigableMap<K,
V>
-
lastEntry
- Specified by:
lastEntry
in interfaceNavigableMap<K,
V>
-
size
-
isEmpty
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
keySet
-
values
-
entrySet
-
put
-
remove
-
clear
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
replace
-
replace
-
pollFirstEntry
- Specified by:
pollFirstEntry
in interfaceNavigableMap<K,
V>
-
pollLastEntry
- Specified by:
pollLastEntry
in interfaceNavigableMap<K,
V>
-
descendingMap
- Specified by:
descendingMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
descendingMap
in interfaceNavigableMap<K,
V>
-
subMap
-
headMap
-
subMap
public ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) - Specified by:
subMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
subMap
in interfaceNavigableMap<K,
V>
-
headMap
- Specified by:
headMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
headMap
in interfaceNavigableMap<K,
V>
-
descendingKeySet
- Specified by:
descendingKeySet
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
descendingKeySet
in interfaceNavigableMap<K,
V>
-