ehcache

net.sf.ehcache.store.chm
Class SelectableConcurrentHashMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by net.sf.ehcache.store.chm.ConcurrentHashMap<Object,Element>
          extended by 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 Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
SelectableConcurrentHashMap(int initialCapacity, float loadFactor, int concurrency)
           
 
Method Summary
 Element[] getRandomValues(int size, Object keyHint)
           
 int quickSize()
          Returns the number of key-value mappings in this map without locking anything.
 
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
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SelectableConcurrentHashMap

public SelectableConcurrentHashMap(int initialCapacity,
                                   float loadFactor,
                                   int concurrency)
Method Detail

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

ehcache

true