com.hazelcast.util
Class SampleableConcurrentHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by com.hazelcast.util.ConcurrentReferenceHashMap<K,V>
          extended by com.hazelcast.util.SampleableConcurrentHashMap<K,V>
Type Parameters:
K - Type of the key
V - Type of the value
All Implemented Interfaces:
Serializable, ConcurrentMap<K,V>, Map<K,V>
Direct Known Subclasses:
CacheRecordHashMap

public class SampleableConcurrentHashMap<K,V>
extends ConcurrentReferenceHashMap<K,V>

ConcurrentHashMap to extend iterator capability.

See Also:
Serialized Form

Nested Class Summary
 class SampleableConcurrentHashMap.IterableSamplingEntry
          Iterable sampling entry to preventing from extra object creation for iteration.
 class SampleableConcurrentHashMap.SamplingEntry
          Entry to define keys and values for sampling.
 
Nested classes/interfaces inherited from class com.hazelcast.util.ConcurrentReferenceHashMap
ConcurrentReferenceHashMap.Option, ConcurrentReferenceHashMap.ReferenceType, ConcurrentReferenceHashMap.SimpleEntry<K,V>, ConcurrentReferenceHashMap.WriteThroughEntry
 
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
SampleableConcurrentHashMap(int initialCapacity)
           
SampleableConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel, ConcurrentReferenceHashMap.ReferenceType keyType, ConcurrentReferenceHashMap.ReferenceType valueType, EnumSet<ConcurrentReferenceHashMap.Option> options)
           
 
Method Summary
protected
<E extends SampleableConcurrentHashMap.SamplingEntry>
E
createSamplingEntry(K key, V value)
           
 int fetch(int tableIndex, int size, List<Data> keys)
          Fetches keys from given tableIndex as size and puts them into keys list.
<E extends SampleableConcurrentHashMap.SamplingEntry>
Iterable<E>
getRandomSamples(int sampleCount)
          Gets and returns samples as sampleCount.
 
Methods inherited from class com.hazelcast.util.ConcurrentReferenceHashMap
clear, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, purgeStaleEntries, 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

SampleableConcurrentHashMap

public SampleableConcurrentHashMap(int initialCapacity)

SampleableConcurrentHashMap

public SampleableConcurrentHashMap(int initialCapacity,
                                   float loadFactor,
                                   int concurrencyLevel,
                                   ConcurrentReferenceHashMap.ReferenceType keyType,
                                   ConcurrentReferenceHashMap.ReferenceType valueType,
                                   EnumSet<ConcurrentReferenceHashMap.Option> options)
Method Detail

fetch

public int fetch(int tableIndex,
                 int size,
                 List<Data> keys)
Fetches keys from given tableIndex as size and puts them into keys list.

Parameters:
tableIndex - Index (checkpoint) for starting point of fetch operation
size - Count of how many keys will be fetched
keys - List that fetched keys will be put into
Returns:
the next index (checkpoint) for later fetches

createSamplingEntry

protected <E extends SampleableConcurrentHashMap.SamplingEntry> E createSamplingEntry(K key,
                                                                                      V value)

getRandomSamples

public <E extends SampleableConcurrentHashMap.SamplingEntry> Iterable<E> getRandomSamples(int sampleCount)
Gets and returns samples as sampleCount.

Parameters:
sampleCount - Count of samples
Returns:
the sampled SampleableConcurrentHashMap.SamplingEntry list


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.