org.apache.ignite.internal.processors.cache.local.atomic

## Class GridLocalAtomicCache<K,V>

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheAdapter<K,V>
  - - org.apache.ignite.internal.processors.cache.local.GridLocalCache<K,V>
    - - org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache<K,V>

All Implemented Interfaces:
  Externalizable, Serializable, Iterable<javax.cache.Cache.Entry<K,V>>, IgniteInternalCache<K,V>

    public class GridLocalAtomicCache<K,V>
    extends GridLocalCache<K,V>

Non-transactional local cache.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.PeekModes, GridCacheAdapter.TopologyVersionAwareJob, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, DFLT_START_CACHE_SIZE, keyCheck, lastFut, locNodeId, log, map, MAX_RETRIES, metrics, RET2NULL, txLockMsgLog`

### Constructor Summary

Constructors
Constructor and Description
`GridLocalAtomicCache()` Empty constructor required by `Externalizable`.
`GridLocalAtomicCache(GridCacheContext<K,V> ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `checkJta()` Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary.
`protected V` `get0(K key, String taskName, boolean deserializeBinary, boolean needVer)`
`Map<K,V>` `getAll0(Collection<? extends K> keys, boolean deserializeBinary, boolean needVer)`
`IgniteInternalFuture<Map<K,V>>` `getAllAsync(Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, boolean skipVals, boolean needVer)`
`protected V` `getAndPut0(K key, V val, CacheEntryPredicate filter)`
`IgniteInternalFuture<V>` `getAndPutAsync0(K key, V val, CacheEntryPredicate filter)`
`protected V` `getAndRemove0(K key)`
`IgniteInternalFuture<V>` `getAndRemoveAsync0(K key)`
`<T> javax.cache.processor.EntryProcessorResult<T>` `invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>` `invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)`
`<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>` `invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>>` `invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)`
`<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>>` `invokeAllAsync(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`<T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>>` `invokeAsync(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)`
`boolean` `isLocal()`
`IgniteInternalFuture<Boolean>` `lockAllAsync(Collection<? extends K> keys, long timeout)` All or nothing synchronous lock for passed in keys.
`void` `onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)`
`GridCachePreloader` `preloader()`
`protected boolean` `put0(K key, V val, CacheEntryPredicate filter)`
`protected void` `putAll0(Map<? extends K,? extends V> m)`
`IgniteInternalFuture<?>` `putAllAsync0(Map<? extends K,? extends V> m)`
`IgniteInternalFuture<Boolean>` `putAsync0(K key, V val, CacheEntryPredicate filter)`
`boolean` `remove0(K key, CacheEntryPredicate filter)`
`void` `removeAll0(Collection<? extends K> keys)`
`IgniteInternalFuture<?>` `removeAllAsync()`
`IgniteInternalFuture<Object>` `removeAllAsync0(Collection<? extends K> keys)`
`IgniteInternalFuture<Boolean>` `removeAsync0(K key, CacheEntryPredicate filter)`
`IgniteInternalFuture<Boolean>` `txLockAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isRead, boolean retval, TransactionIsolation isolation, boolean invalidate, long createTtl, long accessTtl)`
`void` `unlockAll(Collection<? extends K> keys)` Unlocks given keys only if current thread owns the locks.

### Methods inherited from class org.apache.ignite.internal.processors.cache.local.GridLocalCache

`localSizeLong, localSizeLong, lockAllAsync, start`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`active, active, affinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, clear, clear, clearAll, clearAllAsync, clearAsync, clearAsync, clearLocally, clearLocally, clearLocally, clearLocallyAll, clusterMetrics, clusterMetrics, clusterMxBean, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, decrementSize, entries, entryEx, entryEx, entryEx, entrySet, entrySet, evict, evictAll, expiry, expiryPolicy, forceKeyCheck, forSubjectId, get, get, getAll, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPutAsync, getAndPutAsync, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemoveAsync, getAndReplace, getAndReplaceAsync, getAsync, getAsync, getAsync, getEntries, getEntriesAsync, getEntry, getEntryAsync, getForcePrimary, getForcePrimaryAsync, igfsDataSpaceUsed, igniteIterator, igniteIterator, incrementSize, init, invoke, isColocated, isDht, isDhtAtomic, isEmpty, isIgfsDataCache, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, iterator, keepBinary, keySet, loadAll, localEntries, localLoad, localLoadCache, localLoadCacheAsync, localMetrics, localMxBean, localPeek, localSize, lock, lockAll, lockAsync, log, lostPartitions, map, metrics0, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, onIgfsDataSizeChanged, onKernalStart, onKernalStop, onReconnected, onUndeploy, parsePeekModes, peekEx, peekEx, primarySize, primarySizeLong, printMemoryStats, put, put, putAll, putAllAsync, putAllConflict, putAllConflictAsync, putAsync, putAsync, putIfAbsent, putIfAbsentAsync, readExternal, readResolve, rebalance, remove, remove, remove, removeAll, removeAll, removeAllAsync, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeEntry, removeIfObsolete, replace, replace, replaceAsync, replaceAsync, saveFuture, scanIterator, setSkipStore, size, size, sizeAsync, sizeLong, sizeLong, sizeLong, sizeLongAsync, sizeLongAsync, skipStore, splitClearLocally, startInfo, stop, stopInfo, toString, tx, txStart, txStart, txStartEx, unlock, validateCacheKey, validateCacheKeys, withExpiryPolicy, withNoRetries, writeExternal`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### GridLocalAtomicCache

    public GridLocalAtomicCache()

Empty constructor required by `Externalizable`.

#### GridLocalAtomicCache

    public GridLocalAtomicCache(GridCacheContext<K,V> ctx)

Parameters:
  `ctx` - Cache context.

### Method Detail

#### checkJta

    protected void checkJta()
                     throws IgniteCheckedException

Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary.

Overrides:
  `checkJta` in class `GridCacheAdapter<K,V>`
Throws:
  `IgniteCheckedException` - In case of error.

#### isLocal

    public boolean isLocal()

Overrides:
  `isLocal` in class `GridLocalCache<K,V>`
Returns:
  `True` if cache is local.

#### preloader

    public GridCachePreloader preloader()

Overrides:
  `preloader` in class `GridLocalCache<K,V>`
Returns:
  Preloader.

#### getAndPut0

    protected V getAndPut0(K key,
                           V val,
                           @Nullable
                           CacheEntryPredicate filter)
                    throws IgniteCheckedException

Overrides:
  `getAndPut0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Previous value.
Throws:
  `IgniteCheckedException` - If failed.

#### put0

    protected boolean put0(K key,
                           V val,
                           CacheEntryPredicate filter)
                    throws IgniteCheckedException

Overrides:
  `put0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Filter.
Returns:
  `True` if optional filter passed and value was stored in cache, `false` otherwise. Note that this method will return `true` if filter is not specified.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### getAndPutAsync0

    public IgniteInternalFuture<V> getAndPutAsync0(K key,
                                                   V val,
                                                   @Nullable
                                                   CacheEntryPredicate filter)

Overrides:
  `getAndPutAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Put operation future.

#### putAsync0

    public IgniteInternalFuture<Boolean> putAsync0(K key,
                                                   V val,
                                                   @Nullable
                                                   CacheEntryPredicate filter)

Overrides:
  `putAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Putx operation future.

#### putAll0

    protected void putAll0(Map<? extends K,? extends V> m)
                    throws IgniteCheckedException

Overrides:
  `putAll0` in class `GridCacheAdapter<K,V>`
Parameters:
  `m` - Map.
Throws:
  `IgniteCheckedException` - If failed.

#### putAllAsync0

    public IgniteInternalFuture<?> putAllAsync0(Map<? extends K,? extends V> m)

Overrides:
  `putAllAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `m` - Map.
Returns:
  Future.

#### getAndRemove0

    protected V getAndRemove0(K key)
                       throws IgniteCheckedException

Overrides:
  `getAndRemove0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
Returns:
  Previous value.
Throws:
  `IgniteCheckedException` - If failed.

#### getAndRemoveAsync0

    public IgniteInternalFuture<V> getAndRemoveAsync0(K key)

Overrides:
  `getAndRemoveAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
Returns:
  Future.

#### removeAll0

    public void removeAll0(Collection<? extends K> keys)
                    throws IgniteCheckedException

Overrides:
  `removeAll0` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
Throws:
  `IgniteCheckedException` - If failed.

#### removeAllAsync0

    public IgniteInternalFuture<Object> removeAllAsync0(Collection<? extends K> keys)

Overrides:
  `removeAllAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
Returns:
  Future.

#### remove0

    public boolean remove0(K key,
                           CacheEntryPredicate filter)
                    throws IgniteCheckedException

Overrides:
  `remove0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `filter` - Filter.
Returns:
  `True` if entry was removed.
Throws:
  `IgniteCheckedException` - If failed.

#### removeAsync0

    public IgniteInternalFuture<Boolean> removeAsync0(K key,
                                                      @Nullable
                                                      CacheEntryPredicate filter)

Overrides:
  `removeAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `filter` - Filter.
Returns:
  Future.

#### removeAllAsync

    public IgniteInternalFuture<?> removeAllAsync()

Specified by:
  `removeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAllAsync` in class `GridLocalCache<K,V>`
Returns:
  Remove future.

#### get0

    protected V get0(K key,
                     String taskName,
                     boolean deserializeBinary,
                     boolean needVer)
              throws IgniteCheckedException

Overrides:
  `get0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `taskName` - Task name.
  `deserializeBinary` - Deserialize binary flag.
  `needVer` - Need version.
Returns:
  Cached value.
Throws:
  `IgniteCheckedException` - If failed.

#### getAll0

    public final Map<K,V> getAll0(Collection<? extends K> keys,
                                  boolean deserializeBinary,
                                  boolean needVer)
                           throws IgniteCheckedException

Overrides:
  `getAll0` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `deserializeBinary` - Deserialize binary flag.
  `needVer` - Need version.
Returns:
  Map of cached values.
Throws:
  `IgniteCheckedException` - If read failed.

#### getAllAsync

    public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable
                                                      Collection<? extends K> keys,
                                                      boolean forcePrimary,
                                                      boolean skipTx,
                                                      @Nullable
                                                      UUID subjId,
                                                      String taskName,
                                                      boolean deserializeBinary,
                                                      boolean recovery,
                                                      boolean skipVals,
                                                      boolean needVer)

Overrides:
  `getAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `forcePrimary` - Force primary.
  `skipTx` - Skip tx.
  `subjId` - Subj Id.
  `taskName` - Task name.
  `deserializeBinary` - Deserialize binary.
  `recovery` - Recovery mode flag.
  `skipVals` - Skip values.
  `needVer` - Need version.
Returns:
  Future for the get operation.
See Also:
  `GridCacheAdapter.getAllAsync(Collection)`

#### invoke

    public <T> javax.cache.processor.EntryProcessorResult<T> invoke(K key,
                                                                    javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                    Object... args)
                                                             throws IgniteCheckedException

Specified by:
  `invoke` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invoke` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Invoke result.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAll

    public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
                                                                              javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                              Object... args)
                                                                       throws IgniteCheckedException

Specified by:
  `invokeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Invoke results.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAsync

    public <T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> invokeAsync(K key,
                                                                                               javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                                               Object... args)
                                                                                        throws javax.cache.processor.EntryProcessorException

Specified by:
  `invokeAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Future.
Throws:
  `javax.cache.processor.EntryProcessorException`

#### invokeAllAsync

    public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
                                                                                                         javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                                                         Object... args)

Specified by:
  `invokeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Future.

#### invokeAll

    public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
                                                                              Object... args)
                                                                       throws IgniteCheckedException

Specified by:
  `invokeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `map` - Map containing keys and entry processors to be applied to values.
  `args` - Arguments.
Returns:
  Invoke results.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAllAsync

    public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
                                                                                                         Object... args)

Specified by:
  `invokeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `map` - Map containing keys and entry processors to be applied to values.
  `args` - Arguments.
Returns:
  Future.

#### txLockAsync

    public IgniteInternalFuture<Boolean> txLockAsync(Collection<KeyCacheObject> keys,
                                                     long timeout,
                                                     IgniteTxLocalEx tx,
                                                     boolean isRead,
                                                     boolean retval,
                                                     TransactionIsolation isolation,
                                                     boolean invalidate,
                                                     long createTtl,
                                                     long accessTtl)

Overrides:
  `txLockAsync` in class `GridLocalCache<K,V>`
Parameters:
  `keys` - Keys to lock.
  `timeout` - Lock timeout.
  `tx` - Transaction.
  `isRead` - `True` for read operations.
  `retval` - Flag to return value.
  `isolation` - Transaction isolation.
  `invalidate` - Invalidate flag.
  `createTtl` - TTL for create operation.
  `accessTtl` - TTL for read operation.
Returns:
  Locks future.

#### lockAllAsync

    public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable
                                                      Collection<? extends K> keys,
                                                      long timeout)

All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

## Transactions

Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use `TransactionConcurrency.PESSIMISTIC` concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Specified by:
  `lockAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `lockAllAsync` in class `GridLocalCache<K,V>`
Parameters:
  `keys` - Keys to lock.
  `timeout` - Timeout in milliseconds to wait for lock to be acquired (`'0'` for no expiration).
Returns:
  Future for the collection of locks. The future will return `true` if all filters passed and locks were acquired before timeout has expired, `false` otherwise.

#### unlockAll

    public void unlockAll(@Nullable
                          Collection<? extends K> keys)
                   throws IgniteCheckedException

Unlocks given keys only if current thread owns the locks. Only the keys that have been locked by calling thread and pass through the filter (if any) will be unlocked. If none of the key locks is owned by current thread, then this method will do nothing.

## Transactions

Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use `TransactionConcurrency.PESSIMISTIC` concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Specified by:
  `unlockAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `unlockAll` in class `GridLocalCache<K,V>`
Parameters:
  `keys` - Keys to unlock.
Throws:
  `IgniteCheckedException` - If unlock execution resulted in error.

#### onDeferredDelete

    public void onDeferredDelete(GridCacheEntryEx entry,
                                 GridCacheVersion ver)

Overrides:
  `onDeferredDelete` in class `GridLocalCache<K,V>`
Parameters:
  `entry` - Entry.
  `ver` - Version.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.5.0
Release Date | : May 23 2018