Class GridCacheConcurrentMapImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl
-
- All Implemented Interfaces:
GridCacheConcurrentMap
- Direct Known Subclasses:
GridCacheLocalConcurrentMap,GridDhtLocalPartition
public abstract class GridCacheConcurrentMapImpl extends Object implements GridCacheConcurrentMap
Implementation of concurrent cache map.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap
GridCacheConcurrentMap.CacheMapHolder
-
-
Constructor Summary
Constructors Constructor Description GridCacheConcurrentMapImpl(GridCacheMapEntryFactory factory)Creates a new, empty map with the specified initial capacity.
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap
decrementPublicSize, incrementPublicSize, internalSize, publicSize
-
-
-
-
Constructor Detail
-
GridCacheConcurrentMapImpl
public GridCacheConcurrentMapImpl(GridCacheMapEntryFactory factory)
Creates a new, empty map with the specified initial capacity.- Parameters:
factory- Entry factory.- Throws:
IllegalArgumentException- if the initial capacity is negative.
-
-
Method Detail
-
getEntry
@Nullable public @Nullable GridCacheMapEntry getEntry(GridCacheContext ctx, KeyCacheObject key)
Returns the entry associated with the specified key in the HashMap. Returns null if the HashMap contains no mapping for this key.- Specified by:
getEntryin interfaceGridCacheConcurrentMap- Parameters:
ctx- Cache context.key- Key.- Returns:
- Entry.
-
putEntryIfObsoleteOrAbsent
public GridCacheMapEntry putEntryIfObsoleteOrAbsent(GridCacheContext ctx, AffinityTopologyVersion topVer, KeyCacheObject key, boolean create, boolean skipReserve)
- Specified by:
putEntryIfObsoleteOrAbsentin interfaceGridCacheConcurrentMap- Parameters:
ctx- Cache context.topVer- Topology version.key- Key.create- Create flag.skipReserve- Skip partition reservation flag.- Returns:
- Existing or new GridCacheMapEntry. Will return
nullif entry is obsolete or absent and create flag is set tofalse. Will also returnnullif create flag is set totrue, but entry couldn't be created.
-
putEntryIfObsoleteOrAbsent
protected final GridCacheMapEntry putEntryIfObsoleteOrAbsent(@Nullable @Nullable GridCacheConcurrentMap.CacheMapHolder hld, GridCacheContext ctx, AffinityTopologyVersion topVer, KeyCacheObject key, boolean create, boolean skipReserve)
- Parameters:
hld- Holder.ctx- Context.topVer- Topology version.key- Key.create- Create flag.skipReserve-Trueif a partition reservation should be skipped.
-
entriesMap
@Nullable protected abstract @Nullable GridCacheConcurrentMap.CacheMapHolder entriesMap(GridCacheContext cctx)
- Parameters:
cctx- Cache context.- Returns:
- Map for given cache ID.
-
entriesMapIfExists
@Nullable protected abstract @Nullable GridCacheConcurrentMap.CacheMapHolder entriesMapIfExists(Integer cacheId)
- Parameters:
cacheId- Cache ID.- Returns:
- Map for given cache ID.
-
reserve
protected boolean reserve()
-
release
protected void release()
-
release
protected void release(int sizeChange, GridCacheConcurrentMap.CacheMapHolder hld, GridCacheEntryEx e)- Parameters:
sizeChange- Size delta.hld- Map holder.e- Map entry.
-
removeEntry
public boolean removeEntry(GridCacheEntryEx entry)
Removes passed in entry if it presents in the map.- Specified by:
removeEntryin interfaceGridCacheConcurrentMap- Parameters:
entry- Entry to remove.- Returns:
Trueif remove happened.
-
entries
public Collection<GridCacheMapEntry> entries(int cacheId, CacheEntryPredicate... filter)
- Specified by:
entriesin interfaceGridCacheConcurrentMap- Parameters:
cacheId- Cache ID.filter- Filter.- Returns:
- Iterable of the mappings contained in this map, excluding entries in unvisitable state.
-
entrySet
public Set<GridCacheMapEntry> entrySet(int cacheId, CacheEntryPredicate... filter)
- Specified by:
entrySetin interfaceGridCacheConcurrentMap- Parameters:
cacheId- Cache ID.filter- Filter.- Returns:
- Set of the mappings contained in this map.
-
-