public class GridCacheConcurrentMap extends Object
| Modifier and Type | Field and Description |
|---|---|
protected GridCacheContext |
ctx
Cache context.
|
static CacheEntryPredicate[] |
NON_INTERNAL_ARR
Non-internal predicate array.
|
| Modifier | Constructor and Description |
|---|---|
|
GridCacheConcurrentMap(GridCacheContext ctx,
int initCap)
Creates a new, empty map with the specified initial capacity,
and with default load factor (0.75) and concurrencyLevel (16).
|
|
GridCacheConcurrentMap(GridCacheContext ctx,
int initCap,
float loadFactor)
Creates a new, empty map with the specified initial capacity
and load factor and with the default concurrencyLevel (16).
|
protected |
GridCacheConcurrentMap(GridCacheContext ctx,
int initCap,
float loadFactor,
int concurrencyLevel)
Creates a new, empty map with the specified initial
capacity, load factor and concurrency level.
|
| Modifier and Type | Method and Description |
|---|---|
Set<GridCacheEntryEx> |
allEntries0()
Gets all internal entry set, including
GridCacheInternal entries. |
<K,V> Collection<V> |
allValues(CacheEntryPredicate[] filter)
Collection of all (possibly
null) values. |
void |
checkConsistency() |
boolean |
containsKey(Object key) |
void |
decrementSize(GridCacheMapEntry e) |
<K,V> Set<javax.cache.Cache.Entry<K,V>> |
entries(CacheEntryPredicate... filter) |
Set<GridCacheEntryEx> |
entries0()
Internal entry set, excluding
GridCacheInternal entries. |
<K,V> Set<javax.cache.Cache.Entry<K,V>> |
entriesx(CacheEntryPredicate... filter)
Returns entry set containing internal entries.
|
GridCacheMapEntry |
getEntry(Object key)
Returns the entry associated with the specified key in the
HashMap.
|
protected static int |
hash(int h)
Applies a supplemental hash function to a given hashCode, which
defends against poor quality hash functions.
|
void |
incrementSize(GridCacheMapEntry e) |
boolean |
isEmpty() |
<K,V> Set<K> |
keySet(CacheEntryPredicate... filter)
Key set.
|
int |
publicSize() |
void |
putAll(Map<KeyCacheObject,CacheObject> m)
Copies all of the mappings from the specified map to this map
These mappings will replace any mappings that
this map had for any of the keys currently in the specified map.
|
GridCacheMapEntry |
putEntry(AffinityTopologyVersion topVer,
KeyCacheObject key,
CacheObject val) |
GridTriple<GridCacheMapEntry> |
putEntryIfObsoleteOrAbsent(AffinityTopologyVersion topVer,
KeyCacheObject key,
CacheObject val,
boolean create) |
GridCacheMapEntry |
randomEntry() |
boolean |
removeEntry(GridCacheEntryEx e)
Removes passed in entry if it presents in the map.
|
GridCacheMapEntry |
removeEntryIfObsolete(KeyCacheObject key)
Removes and returns the entry associated with the specified key
in the HashMap if entry is obsolete.
|
void |
setEntryFactory(GridCacheMapEntryFactory factory)
Sets factory for entries.
|
int |
size()
Returns the number of key-value mappings in this map.
|
Iterator<GridCacheEntryEx> |
stripedEntryIterator(int id,
int totalCnt)
Get striped entry iterator.
|
String |
toString() |
<K,V> Collection<V> |
values(CacheEntryPredicate... filter)
Collection of non-
null values. |
protected final GridCacheContext ctx
public static final CacheEntryPredicate[] NON_INTERNAL_ARR
protected GridCacheConcurrentMap(GridCacheContext ctx, int initCap, float loadFactor, int concurrencyLevel)
ctx - Cache context.initCap - the initial capacity. The implementation
performs internal sizing to accommodate this many elements.loadFactor - the load factor threshold, used to control resizing.
Resizing may be performed when the average number of elements per
bin exceeds this threshold.concurrencyLevel - the estimated number of concurrently
updating threads. The implementation performs internal sizing
to try to accommodate this many threads.IllegalArgumentException - if the initial capacity is
negative or the load factor or concurrencyLevel are
non-positive.public GridCacheConcurrentMap(GridCacheContext ctx, int initCap, float loadFactor)
ctx - Cache context.initCap - The implementation performs internal
sizing to accommodate this many elements.loadFactor - the load factor threshold, used to control resizing.
Resizing may be performed when the average number of elements per
bin exceeds this threshold.IllegalArgumentException - if the initial capacity of
elements is negative or the load factor is non-positive.public GridCacheConcurrentMap(GridCacheContext ctx, int initCap)
ctx - Cache context.initCap - the initial capacity. The implementation
performs internal sizing to accommodate this many elements.IllegalArgumentException - if the initial capacity of
elements is negative.protected static int hash(int h)
This function has been taken from Java 8 ConcurrentHashMap with slightly modifications.
h - Value to hash.public void setEntryFactory(GridCacheMapEntryFactory factory)
factory - Entry factory.public boolean isEmpty()
True if this map is empty.public int size()
public int publicSize()
public void decrementSize(GridCacheMapEntry e)
e - Cache map entry.public void incrementSize(GridCacheMapEntry e)
e - Cache map entry.public boolean containsKey(Object key)
key - Key.True if map contains mapping for provided key.public <K,V> Collection<V> allValues(CacheEntryPredicate[] filter)
null) values.filter - Filter.@Nullable public GridCacheMapEntry randomEntry()
@Nullable public GridCacheMapEntry getEntry(Object key)
key - Key.public GridCacheMapEntry putEntry(AffinityTopologyVersion topVer, KeyCacheObject key, @Nullable CacheObject val)
topVer - Topology version.key - Key.val - Value.public GridTriple<GridCacheMapEntry> putEntryIfObsoleteOrAbsent(AffinityTopologyVersion topVer, KeyCacheObject key, @Nullable CacheObject val, boolean create)
topVer - Topology version.key - Key.val - Value.create - Create flag.public void putAll(Map<KeyCacheObject,CacheObject> m)
m - mappings to be stored in this map.NullPointerException - If the specified map is null.public boolean removeEntry(GridCacheEntryEx e)
e - Entry to remove.True if remove happened.@Nullable public GridCacheMapEntry removeEntryIfObsolete(KeyCacheObject key)
key - Key.null.public <K,V> Set<javax.cache.Cache.Entry<K,V>> entries(CacheEntryPredicate... filter)
filter - Filter.public <K,V> Set<javax.cache.Cache.Entry<K,V>> entriesx(CacheEntryPredicate... filter)
filter - Filter.public Set<GridCacheEntryEx> entries0()
GridCacheInternal entries.public Iterator<GridCacheEntryEx> stripedEntryIterator(int id, int totalCnt)
id - Expected modulo.totalCnt - Maximum modulo.public Set<GridCacheEntryEx> allEntries0()
GridCacheInternal entries.GridCacheInternal entries.public <K,V> Set<K> keySet(CacheEntryPredicate... filter)
filter - Filter.public <K,V> Collection<V> values(CacheEntryPredicate... filter)
null values.filter - Filter.public void checkConsistency()
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015