org.apache.ignite.internal.processors.cache

## 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 and Description
`GridCacheConcurrentMapImpl(GridCacheMapEntryFactory factory)` Creates a new, empty map with the specified initial capacity.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`Collection<GridCacheMapEntry>` `entries(int cacheId, CacheEntryPredicate... filter)`
`protected abstract @Nullable GridCacheConcurrentMap.CacheMapHolder` `entriesMap(GridCacheContext cctx)`
`protected abstract @Nullable GridCacheConcurrentMap.CacheMapHolder` `entriesMapIfExists(Integer cacheId)`
`Set<GridCacheMapEntry>` `entrySet(int cacheId, CacheEntryPredicate... filter)`
`@Nullable GridCacheMapEntry` `getEntry(GridCacheContext ctx, KeyCacheObject key)` Returns the entry associated with the specified key in the HashMap.
`protected GridCacheMapEntry` `putEntryIfObsoleteOrAbsent(@Nullable GridCacheConcurrentMap.CacheMapHolder hld, GridCacheContext ctx, AffinityTopologyVersion topVer, KeyCacheObject key, boolean create, boolean touch)`
`@Nullable GridCacheMapEntry` `putEntryIfObsoleteOrAbsent(GridCacheContext ctx, AffinityTopologyVersion topVer, KeyCacheObject key, boolean create, boolean touch)`
`protected void` `release()`
`protected void` `release(int sizeChange, GridCacheConcurrentMap.CacheMapHolder hld, GridCacheEntryEx e)`
`boolean` `removeEntry(GridCacheEntryEx entry)` Removes passed in entry if it presents in the map.
`protected boolean` `reserve()`

### 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:
  `getEntry` in interface `GridCacheConcurrentMap`
Parameters:
  `ctx` - Cache context.
  `key` - Key.
Returns:
  Entry.

#### putEntryIfObsoleteOrAbsent

    @Nullable
    public @Nullable GridCacheMapEntry putEntryIfObsoleteOrAbsent(GridCacheContext ctx,
                                                                            AffinityTopologyVersion topVer,
                                                                            KeyCacheObject key,
                                                                            boolean create,
                                                                            boolean touch)

Specified by:
  `putEntryIfObsoleteOrAbsent` in interface `GridCacheConcurrentMap`
Parameters:
  `ctx` - Cache context.
  `topVer` - Topology version.
  `key` - Key.
  `create` - Create flag.
Returns:
  Existing or new GridCacheMapEntry. Will return `null` if entry is obsolete or absent and create flag is set to `false`. Will also return `null` if create flag is set to `true`, 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 touch)

#### 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:
  `removeEntry` in interface `GridCacheConcurrentMap`
Parameters:
  `entry` - Entry to remove.
Returns:
  `True` if remove happened.

#### entries

    public Collection<GridCacheMapEntry> entries(int cacheId,
                                                 CacheEntryPredicate... filter)

Specified by:
  `entries` in interface `GridCacheConcurrentMap`
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:
  `entrySet` in interface `GridCacheConcurrentMap`
Parameters:
  `cacheId` - Cache ID.
  `filter` - Filter.
Returns:
  Set of the mappings contained in this map.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020