org.terracotta.collections.chm
Class SelectableConcurrentHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.terracotta.collections.chm.ConcurrentHashMap<K,V>
org.terracotta.collections.chm.SelectableConcurrentHashMap<K,V>
- All Implemented Interfaces:
- Serializable, ConcurrentMap<K,V>, Map<K,V>
public class SelectableConcurrentHashMap<K,V>
- extends ConcurrentHashMap<K,V>
SelectableConcurrentHashMap subclasses a repackaged version of ConcurrentHashMap ito allow efficient random sampling
of the map values.
The random sampling technique involves randomly selecting a map Segment, and then selecting a number of random entry
chains from that segment.
- Author:
- Chris Dennis
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
|
Method Summary |
Map.Entry<K,V> |
getRandomEntry()
|
Map.Entry<K,V> |
getRandomLocalEntry()
|
ConcurrentHashMap.HashEntry<K,V> |
putReturnHashEntry(K key,
V newValue)
|
ConcurrentHashMap.HashEntry<K,V> |
removeReturnHashEntry(Object key)
|
ConcurrentHashMap.HashEntry<K,V> |
removeReturnHashEntry(Object key,
Object value)
|
ConcurrentHashMap.HashEntry<K,V> |
replaceReturnHashEntry(K key,
V newValue)
|
ConcurrentHashMap.HashEntry<K,V> |
replaceReturnHashEntry(K key,
V oldValue,
V newValue)
|
boolean |
replaceUsingReferenceEquality(K key,
V oldValue,
V newValue)
Similar to ConcurrentHashMap.replace(Object, Object, Object), only difference is that it uses reference equality instead of
object equality when comparing the oldValue and newValue |
| Methods inherited from class org.terracotta.collections.chm.ConcurrentHashMap |
clear, contains, containsKey, containsValue, elements, entrySet, get, hash, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values |
SelectableConcurrentHashMap
public SelectableConcurrentHashMap()
SelectableConcurrentHashMap
public SelectableConcurrentHashMap(int initialCapacity,
float loadFactor,
int concurrency)
getRandomEntry
public Map.Entry<K,V> getRandomEntry()
getRandomLocalEntry
public Map.Entry<K,V> getRandomLocalEntry()
replaceUsingReferenceEquality
public boolean replaceUsingReferenceEquality(K key,
V oldValue,
V newValue)
- Similar to
ConcurrentHashMap.replace(Object, Object, Object), only difference is that it uses reference equality instead of
object equality when comparing the oldValue and newValue
- Throws:
NullPointerException - if any of the arguments are null
removeReturnHashEntry
public ConcurrentHashMap.HashEntry<K,V> removeReturnHashEntry(Object key)
removeReturnHashEntry
public ConcurrentHashMap.HashEntry<K,V> removeReturnHashEntry(Object key,
Object value)
replaceReturnHashEntry
public ConcurrentHashMap.HashEntry<K,V> replaceReturnHashEntry(K key,
V oldValue,
V newValue)
putReturnHashEntry
public ConcurrentHashMap.HashEntry<K,V> putReturnHashEntry(K key,
V newValue)
replaceReturnHashEntry
public ConcurrentHashMap.HashEntry<K,V> replaceReturnHashEntry(K key,
V newValue)
Copyright © 2010 Terracotta, Inc.. All Rights Reserved.