net.sf.ehcache.store.chm
Class SelectableConcurrentHashMap
java.lang.Object
java.util.AbstractMap<K,V>
net.sf.ehcache.store.chm.ConcurrentHashMap<Object,Element>
net.sf.ehcache.store.chm.SelectableConcurrentHashMap
- All Implemented Interfaces:
- Serializable, ConcurrentMap<Object,Element>, Map<Object,Element>
public class SelectableConcurrentHashMap
- extends ConcurrentHashMap<Object,Element>
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> |
Methods inherited from class net.sf.ehcache.store.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(int initialCapacity,
float loadFactor,
int concurrency)
getRandomValues
public Element[] getRandomValues(int size,
Object keyHint)
quickSize
public int quickSize()
- Returns the number of key-value mappings in this map without locking anything.
This may not give the exact element count as locking is avoided.
If the map contains more than Integer.MAX_VALUE elements, returns
Integer.MAX_VALUE.
- Returns:
- the number of key-value mappings in this map
true