aa
|
A lock-free alternate implementation of java.util.concurrent.ConcurrentHashMap with better scaling properties and generally lower costs to mutate the Map. More...
Classes | |
class | CHM |
class | NBHMEntry |
class | Prime |
class | SnapshotE |
class | SnapshotK |
class | SnapshotV |
Public Member Functions | |
NonBlockingHashMap () | |
Create a new NonBlockingHashMap with default minimum size (currently set to 8 K/V pairs or roughly 84 bytes on a standard 32-bit JVM). More... | |
NonBlockingHashMap (final int initial_sz) | |
Create a new NonBlockingHashMap with initial room for the given number of elements, thus avoiding internal resizing operations to reach an appropriate size. More... | |
void | clear () |
Removes all of the mappings from this map. More... | |
Object | clone () |
Creates a shallow copy of this hashtable. More... | |
boolean | contains (Object val) |
Legacy method testing if some key maps into the specified value in this table. More... | |
boolean | containsKey (Object key) |
Tests if the key in the table using the equals method. More... | |
boolean | containsValue (final Object val) |
Returns true if this Map maps one or more keys to the specified value. More... | |
Enumeration< TypeV > | elements () |
Returns an enumeration of the values in this table. More... | |
Set< Map.Entry< TypeK, TypeV > > | entrySet () |
Returns a Set view of the mappings contained in this map. More... | |
TypeV | get (Object key) |
Returns the value to which the specified key is mapped, or. More... | |
TypeK | getk (TypeK key) |
Returns the Key to which the specified key is mapped, or. More... | |
TypeK | getKey () |
boolean | isEmpty () |
Returns size() == 0 . More... | |
Enumeration< TypeK > | keys () |
Returns an enumeration of the keys in this table. More... | |
Set< TypeK > | keySet () |
Returns a Set view of the keys contained in this map. More... | |
final void | print () |
Verbose printout of table internals, useful for debugging. More... | |
TypeV | put (TypeK key, TypeV val) |
Maps the specified key to the specified value in the table. More... | |
void | putAll (Map<? extends TypeK, ? extends TypeV > m) |
Copies all of the mappings from the specified map to this one, replacing any existing mappings. More... | |
TypeV | putIfAbsent (TypeK key, TypeV val) |
Atomically, do a put if-and-only-if the key is not mapped. More... | |
final TypeV | putIfMatchAllowNull (Object key, Object newVal, Object oldVal) |
Object[] | raw_array () |
TypeV | remove (Object key) |
Removes the key (and its corresponding value) from this map. More... | |
boolean | remove (Object key, Object val) |
Atomically do a remove(Object) if-and-only-if the key is mapped to a value which is equals to the given value. More... | |
boolean | replace (TypeK key, TypeV oldValue, TypeV newValue) |
Atomically do a put(key,newValue) if-and-only-if the key is mapped a value which is equals to oldValue . More... | |
TypeV | replace (TypeK key, TypeV val) |
Atomically do a put(key,val) if-and-only-if the key is mapped to some value already. More... | |
long | reprobes () |
Get and clear the current count of reprobes. More... | |
int | size () |
Returns the number of key-value mappings in this map. More... | |
String | toString () |
Returns a string representation of this map. More... | |
Collection< TypeV > | values () |
Returns a Collection view of the values contained in this map. More... | |
Static Public Attributes | |
static final Object | TOMBSTONE = new Object() |
Protected Member Functions | |
final void | initialize () |
void | rehash () |
Static Package Functions | |
[static initializer] | |
Static Package Attributes | |
static volatile int | DUMMY_VOLATILE |
Private Member Functions | |
boolean | CAS_kvs (final Object[] oldkvs, final Object[] newkvs) |
final Object[] | help_copy (Object[] helper) |
final void | initialize (int initial_sz) |
final void | print (Object[] kvs) |
final void | print2 (Object[] kvs) |
final TypeV | putIfMatch (Object key, Object newVal, Object oldVal) |
void | readObject (java.io.ObjectInputStream s) throws IOException, ClassNotFoundException |
void | writeObject (java.io.ObjectOutputStream s) throws IOException |
Static Private Member Functions | |
static Object | _getKey (Object[] kvs) |
static final boolean | CAS_key (Object[] kvs, int idx, Object old, Object key) |
static final boolean | CAS_val (Object[] kvs, int idx, Object old, Object val) |
static final CHM | chm (Object[] kvs) |
static Object | get_impl (final NonBlockingHashMap topmap, final Object[] kvs, final Object key) |
static final Object | getk_impl (final NonBlockingHashMap topmap, final Object[] kvs, final Object key) |
static int | hash (final Object key) |
static final int[] | hashes (Object[] kvs) |
static final Object | key (Object[] kvs, int idx) |
static boolean | keyeq (Object K, Object key, int[] hashes, int hash, int fullhash) |
static final int | len (Object[] kvs) |
static final Object | putIfMatch (final NonBlockingHashMap topmap, final Object[] kvs, final Object key, final Object putval, final Object expVal) |
static long | rawIndex (final Object[] ary, final int idx) |
static final int | reprobe_limit (int len) |
static final Object | val (Object[] kvs, int idx) |
Private Attributes | |
transient Object[] | _kvs |
transient long | _last_resize_milli |
transient ConcurrentAutoTable | _reprobes = new ConcurrentAutoTable() |
Static Private Attributes | |
static final long | _kvs_offset |
static final int | _Obase = _unsafe.arrayBaseOffset(Object[].class) |
static final int | _Olog = _Oscale==4?2:(_Oscale==8?3:9999) |
static final int | _Oscale = _unsafe.arrayIndexScale(Object[].class) |
static final Unsafe | _unsafe = UtilUnsafe.getUnsafe() |
static final Object | MATCH_ANY = new Object() |
static final int | MIN_SIZE =(1<<MIN_SIZE_LOG) |
static final int | MIN_SIZE_LOG =3 |
static final Object | NO_MATCH_OLD = new Object() |
static final int | REPROBE_LIMIT =10 |
static final long | serialVersionUID = 1234123412341234123L |
static final Prime | TOMBPRIME = new Prime(TOMBSTONE) |
A lock-free alternate implementation of java.util.concurrent.ConcurrentHashMap with better scaling properties and generally lower costs to mutate the Map.
It provides identical correctness properties as ConcurrentHashMap. All operations are non-blocking and multi-thread safe, including all update operations. NonBlockingHashMap scales substantially better than java.util.concurrent.ConcurrentHashMap for high update rates, even with a large concurrency factor. Scaling is linear up to 768 CPUs on a 768-CPU Azul box, even with 100% updates or 100% reads or any fraction in-between. Linear scaling up to all cpus has been observed on a 32-way Sun US2 box, 32-way Sun Niagara box, 8-way Intel box and a 4-way Power box.
This class obeys the same functional specification as {}, and includes versions of methods corresponding to each method of Hashtable
. However, even though all operations are thread-safe, operations do not entail locking and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable
in programs that rely on its thread safety but not on its synchronization details. Operations (including put
) generally do not block, so may overlap with other update operations (including other puts
and removes
). Retrievals reflect the results of the most recently completed update operations holding upon their onset. For aggregate operations such as putAll
, concurrent retrievals may reflect insertion or removal of only some entries. Similarly, Iterators and Enumerations return elements reflecting the state of the hash table at some point at or since the creation of the iterator/enumeration. They do not throw ConcurrentModificationException. However, iterators are designed to be used by only one thread at a time.
Very full tables, or tables with high reprobe rates may trigger an internal resize operation to move into a larger table. Resizing is not terribly expensive, but it is not free either; during resize operations table throughput may drop somewhat. All threads that visit the table during a resize will 'help' the resizing but will still be allowed to complete their operation before the resize is finished (i.e., a simple 'get' operation on a million-entry table undergoing resizing will not need to block until the entire million entries are copied).
This class and its views and iterators implement all of the optional methods of the Map and Iterator interfaces.
Like Hashtable but unlike HashMap, this class does not allow null
to be used as a key or value.
<TypeK> | the type of keys maintained by this map |
<TypeV> | the type of mapped values |
Definition at line 73 of file NonBlockingHashMap.java.
com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.NonBlockingHashMap | ( | ) |
Create a new NonBlockingHashMap with default minimum size (currently set to 8 K/V pairs or roughly 84 bytes on a standard 32-bit JVM).
Definition at line 251 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clear().
com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.NonBlockingHashMap | ( | final int | initial_sz | ) |
Create a new NonBlockingHashMap with initial room for the given number of elements, thus avoiding internal resizing operations to reach an appropriate size.
Large numbers here when used with a small count of elements will sacrifice space for a small amount of time gained. The initial size will be rounded up internally to the next larger power of 2.
Definition at line 258 of file NonBlockingHashMap.java.
|
staticpackage |
|
staticprivate |
Definition at line 478 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getKey().
|
staticprivate |
Definition at line 174 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
private |
Definition at line 101 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clear(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_check_and_promote().
|
staticprivate |
Definition at line 177 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
staticprivate |
Definition at line 135 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_check_and_promote(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot_and_check(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.help_copy(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.help_copy_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.resize(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.size(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.SnapshotV().
void com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.clear | ( | ) |
Removes all of the mappings from this map.
Definition at line 381 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clone(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.entrySet(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keySet(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.values().
Object com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.clone | ( | ) |
Creates a shallow copy of this hashtable.
All the structure of the hashtable itself is copied, but the keys and values are not cloned. This is a relatively expensive operation.
Definition at line 417 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clone().
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.contains | ( | Object | val | ) |
Legacy method testing if some key maps into the specified value in this table.
This method is identical in functionality to {}, and exists solely to ensure full compatibility with class java.util.Hashtable}, which supported this method prior to introduction of the Java Collections framework. val a value to search for true
if this map maps one or more keys to the specified value NullPointerException if the specified value is null
Definition at line 298 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.entrySet(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keySet(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.values().
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.containsKey | ( | Object | key | ) |
Tests if the key in the table using the equals
method.
true
if the key is in the table using the equals
method NullPointerException | if the specified key is null |
Definition at line 288 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keySet().
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.containsValue | ( | final Object | val | ) |
Returns true
if this Map maps one or more keys to the specified value.
Note: This method requires a full internal traversal of the hash table and is much slower than containsKey.
val | value whose presence in this map is to be tested |
true
if this map maps one or more keys to the specified value NullPointerException | if the specified value is null |
Definition at line 394 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.contains(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.values().
Enumeration<TypeV> com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.elements | ( | ) |
Returns an enumeration of the values in this table.
Definition at line 1248 of file NonBlockingHashMap.java.
Set<Map.Entry<TypeK,TypeV> > com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.entrySet | ( | ) |
Returns a Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove
, Set.remove
, removeAll
, retainAll
, and clear
operations. It does not support the add
or addAll
operations.
The view's iterator
is a "weakly consistent" iterator that will never throw ConcurrentModificationException, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
Warning: the iterator associated with this Set requires the creation of java.util.Map.Entry objects with each iteration. The NonBlockingHashMap does not normally create or using java.util.Map.Entry objects so they will be created soley to support this iteration. Iterating using keySet or {} will be more efficient.
Definition at line 1358 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.toString().
TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.get | ( | Object | key | ) |
Returns the value to which the specified key is mapped, or.
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
to a value
such that
, then this method returns
; otherwise it returns
. (There can be at most one such mapping.)
NullPointerException | if the specified key is null |
Definition at line 524 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 531 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl().
TypeK com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.getk | ( | TypeK | key | ) |
Returns the Key to which the specified key is mapped, or.
if this map contains no mapping for the key.
NullPointerException | if the specified key is null |
Definition at line 585 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 589 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl().
TypeK com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.getKey | ( | ) |
Definition at line 477 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 114 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keyeq(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
staticprivate |
Definition at line 136 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keyeq(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
private |
Definition at line 788 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot_and_check(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
protected |
Definition at line 271 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.initialize(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.NonBlockingHashMap(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.readObject().
|
private |
Definition at line 259 of file NonBlockingHashMap.java.
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.isEmpty | ( | ) |
|
staticprivate |
Definition at line 172 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_key(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.containsKey(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.hash(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.key(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keyeq(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.put(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfAbsent(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatchAllowNull(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.remove(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.replace(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.toString().
|
staticprivate |
Definition at line 495 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
Enumeration<TypeK> com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.keys | ( | ) |
Returns an enumeration of the keys in this table.
Definition at line 1289 of file NonBlockingHashMap.java.
Set<TypeK> com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.keySet | ( | ) |
Returns a Set view of the keys contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding mapping from this map, via the Iterator.remove
, Set.remove
, removeAll
, retainAll
, and clear
operations. It does not support the add
or addAll
operations.
The view's iterator
is a "weakly consistent" iterator that will never throw ConcurrentModificationException, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
Definition at line 1305 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clone(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.writeObject().
|
staticprivate |
Definition at line 138 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_check_and_promote(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.help_copy_impl(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.length(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.reprobe_limit(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.resize(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.tableFull().
final void com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.print | ( | ) |
Verbose printout of table internals, useful for debugging.
Definition at line 184 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print().
|
private |
Definition at line 190 of file NonBlockingHashMap.java.
|
private |
Definition at line 209 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2().
TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.put | ( | TypeK | key, |
TypeV | val | ||
) |
Maps the specified key to the specified value in the table.
Neither key nor value can be null.
The value can be retrieved by calling get with a key that is equal to the original key.
key | key with which the specified value is to be associated |
val | value to be associated with the specified key |
key
, or null
if there was no mapping for key
NullPointerException | if the specified key or value is null |
Definition at line 310 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clone(), com.cliffc.aa.tvar.TV2.make(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putAll(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.readObject(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.NBHMEntry.setValue().
void com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.putAll | ( | Map<? extends TypeK, ? extends TypeV > | m | ) |
Copies all of the mappings from the specified map to this one, replacing any existing mappings.
m | mappings to be stored in this map |
Definition at line 374 of file NonBlockingHashMap.java.
TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.putIfAbsent | ( | TypeK | key, |
TypeV | val | ||
) |
Atomically, do a put if-and-only-if the key is not mapped.
Useful to ensure that only a single mapping for the key exists, even if many threads are trying to create the mapping in parallel.
null
if there was no mapping for the key NullPointerException | if the specified key or value is null |
Definition at line 318 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 638 of file NonBlockingHashMap.java.
|
private |
Definition at line 361 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.put(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfAbsent(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatchAllowNull(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.remove(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.remove(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.replace().
final TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.putIfMatchAllowNull | ( | Object | key, |
Object | newVal, | ||
Object | oldVal | ||
) |
Definition at line 351 of file NonBlockingHashMap.java.
Object [] com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.raw_array | ( | ) |
Definition at line 1243 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 86 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_key(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_val().
|
private |
Definition at line 1393 of file NonBlockingHashMap.java.
|
protected |
Definition at line 405 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.resize().
TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.remove | ( | Object | key | ) |
Removes the key (and its corresponding value) from this map.
This method does nothing if the key is not in the map.
key
, or null
if there was no mapping for key
NullPointerException | if the specified key is null |
Definition at line 326 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.entrySet(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keySet().
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.remove | ( | Object | key, |
Object | val | ||
) |
Atomically do a remove(Object) if-and-only-if the key is mapped to a value which is equals
to the given value.
NullPointerException | if the specified key or value is null |
Definition at line 331 of file NonBlockingHashMap.java.
boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.replace | ( | TypeK | key, |
TypeV | oldValue, | ||
TypeV | newValue | ||
) |
Atomically do a put(key,newValue)
if-and-only-if the key is mapped a value which is equals
to oldValue
.
NullPointerException | if the specified key or value is null |
Definition at line 341 of file NonBlockingHashMap.java.
TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.replace | ( | TypeK | key, |
TypeV | val | ||
) |
Atomically do a put(key,val)
if-and-only-if the key is mapped to some value already.
NullPointerException | if the specified key or value is null |
Definition at line 336 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 242 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.tableFull().
long com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.reprobes | ( | ) |
Get and clear the current count of reprobes.
Reprobes happen on key collisions, and a high reprobe rate may indicate a poor hash function or weaknesses in the table resizing function.
Definition at line 234 of file NonBlockingHashMap.java.
int com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.size | ( | ) |
Returns the number of key-value mappings in this map.
Definition at line 278 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.entrySet(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.isEmpty(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keySet(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.values().
String com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.toString | ( | ) |
Returns a string representation of this map.
The string representation consists of a list of key-value mappings in the order returned by the map's entrySet
view's iterator, enclosed in braces ("{}"
). Adjacent mappings are separated by the characters ", "
(comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("="
) followed by the associated value. Keys and values are converted to strings as by String#valueOf(Object).
Definition at line 453 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 173 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_val(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.contains(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.containsValue(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.put(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfAbsent(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.remove(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.replace(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.NBHMEntry.setValue(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.val().
Collection<TypeV> com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.values | ( | ) |
Returns a Collection view of the values contained in this map.
The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from this map, via the Iterator.remove
, Collection.remove
, removeAll
, retainAll
, and clear
operations. It does not support the add
or addAll
operations.
The view's iterator
is a "weakly consistent" iterator that will never throw ConcurrentModificationException, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
Definition at line 1265 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.containsValue().
|
private |
Definition at line 1379 of file NonBlockingHashMap.java.
|
private |
Definition at line 134 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clear(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_check_and_promote(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getKey(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.help_copy(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.initialize(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatchAllowNull(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.size(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.SnapshotV().
|
staticprivate |
Definition at line 94 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_kvs().
|
private |
Definition at line 141 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_check_and_promote(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.initialize(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.resize().
|
staticprivate |
Definition at line 83 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.rawIndex().
|
staticprivate |
Definition at line 85 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.rawIndex().
|
staticprivate |
Definition at line 84 of file NonBlockingHashMap.java.
|
private |
Definition at line 228 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.reprobes().
|
staticprivate |
Definition at line 82 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_key(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_kvs(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.CAS_val().
|
staticpackage |
Definition at line 637 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch().
|
staticprivate |
|
staticprivate |
Definition at line 147 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.clear(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.initialize(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.NonBlockingHashMap(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.readObject().
|
staticprivate |
|
staticprivate |
Definition at line 152 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.put(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), and com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.remove().
|
staticprivate |
|
staticprivate |
Definition at line 77 of file NonBlockingHashMap.java.
|
staticprivate |
Definition at line 163 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot().
|
static |
Definition at line 158 of file NonBlockingHashMap.java.
Referenced by com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >._getKey(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.copy_slot(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.get_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.getk_impl(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.keyeq(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.print2(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfAbsent(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatch(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.putIfMatchAllowNull(), com.cliffc.aa.util.NonBlockingHashMap< com.cliffc.aa.type.Type.Key, com.cliffc.aa.type.Type >.remove(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.remove().