org.apache.ignite.internal.processors.cache.distributed

## Class GridDistributedCacheEntry

- java.lang.Object
- - org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
  - - org.apache.ignite.internal.processors.cache.GridCacheMapEntry
    - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry

All Implemented Interfaces:
  GridCacheEntryEx

Direct Known Subclasses:
  GridDhtCacheEntry, GridDhtDetachedCacheEntry, GridNearCacheEntry

    public class GridDistributedCacheEntry
    extends GridCacheMapEntry

Entry for distributed (replicated/partitioned) cache.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter

`GridMetadataAwareAdapter.EntryKey`

### Field Summary

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

`ATOMIC_VER_COMPARATOR, cctx, flags, key, log, logRef, val, ver`

### Constructor Summary

Constructors
Constructor and Description
`GridDistributedCacheEntry(GridCacheContext ctx, KeyCacheObject key)`

### Method Summary

All Methods Instance Methods Concrete Methods
`GridCacheMvccCandidate` `addLocal(long threadId, GridCacheVersion ver, AffinityTopologyVersion topVer, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean read)` Add local candidate.
`void` `addRemote(UUID nodeId, UUID otherNodeId, long threadId, GridCacheVersion ver, boolean tx, boolean implicitSingle, GridCacheVersion owned)` Adds new lock candidate.
`boolean` `addRemoved(GridCacheVersion ver)`
`protected void` `checkCallbacks(boolean emptyBefore, boolean emptyAfter)`
`protected void` `checkRemoved(GridCacheVersion ver)`
`protected void` `checkThreadChain(GridCacheMvccCandidate owner)`
`void` `doneRemote(GridCacheVersion lockVer, GridCacheVersion baseVer, Collection<GridCacheVersion> pendingVers, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, boolean sysInvalidate)`
`CacheLockCandidates` `readyLock(GridCacheVersion ver)`
`void` `readyNearLock(GridCacheVersion ver, GridCacheVersion mapped, Collection<GridCacheVersion> committed, Collection<GridCacheVersion> rolledBack, Collection<GridCacheVersion> pending)` Notifies mvcc that near local lock is ready to be acquired.
`void` `recheck()` Rechecks if lock should be reassigned.
`Collection<GridCacheMvccCandidate>` `remoteMvccSnapshot(GridCacheVersion... exclude)` Gets all remote versions.
`void` `removeExplicitNodeLocks(UUID nodeId)` Removes all lock candidates for node.
`GridCacheMvccCandidate` `removeLock()` Unlocks local lock.
`boolean` `removeLock(GridCacheVersion ver)`
`boolean` `tmLock(IgniteInternalTx tx, long timeout, GridCacheVersion serOrder, GridCacheVersion serReadVer, boolean read)` This locks is called by transaction manager during prepare step for optimistic transactions.
`String` `toString()`
`void` `txUnlock(IgniteInternalTx tx)` Unlocks acquired lock.

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

`allVersionsInfo, candidate, candidate, checkObsolete, checkOwnerChanged, checkSerializableReadVersion, clear, clearReader, clearReaders, clearReserveForLoad, context, decrementMapPublicSize, deleted, deletedUnlocked, deletedUnlocked, detached, equals, evictInternal, evictionDisabled, expireTime, expireTimeExtras, expireTimeUnlocked, hashCode, hasLockCandidate, hasLockCandidate, hasLockCandidateUnsafe, hasReaders, hasValue, hasValueUnlocked, incrementMapPublicSize, info, initialValue, innerGet, innerGetAndReserveForLoad, innerGetVersioned, innerReload, innerRemove, innerSet, innerUpdate, innerUpdateLocal, invalidate, isDht, isInternal, isLocal, isMvcc, isNear, isNew, isNewLocked, isReplicated, isStartVersion, key, keyValue, localCandidate, localCandidates, localOwner, localPartition, lockedBy, lockedByAny, lockedByCurrentThread, lockedByThread, lockedByThread, lockedByThread, lockedByThreadUnsafe, lockedByUnsafe, lockedLocally, lockedLocallyByIdOrThread, lockedLocallyUnsafe, lockEntry, logMvccUpdate, logTxUpdate, logUpdate, markObsolete, markObsolete0, markObsoleteIfEmpty, markObsoleteVersion, memorySize, mvccAllLocal, mvccExtras, mvccExtras, mvccLock, mvccRemove, mvccSet, mvccUpdateRowsWithPreloadInfo, nextPartitionCounter, obsolete, obsolete, obsoleteOrDeleted, obsoleteVersion, obsoleteVersionExtras, onInvalidate, onMarkedObsolete, onTtlExpired, onUnlock, onUpdateFinished, partition, partitionValid, peek, peek, peekVisibleValue, rawExpireTime, rawGet, rawPut, rawTtl, readThrough, recordNodeId, removeValue, storeValue, storeValue, touch, ttl, ttlAndExpireTimeExtras, ttlExtras, txKey, unlockEntry, unswap, unswap, unswap, unswap, update, updateIndex, updateTtl, valid, value, valueBytes, valueBytes, valueBytes0, version, versionedEntry, versionedValue, visitable, wrap, wrapEviction, wrapLazyValue, wrapVersioned`

### Methods inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter

`addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, readExternalMeta, removeAllMeta, removeMeta, removeMeta, replaceMeta, writeExternalMeta`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheEntryEx

`addMeta, hasMeta, initialValue, meta, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta`

### Constructor Detail

#### GridDistributedCacheEntry

    public GridDistributedCacheEntry(GridCacheContext ctx,
                                     KeyCacheObject key)

Parameters:
  `ctx` - Cache context.
  `key` - Cache key.

### Method Detail

#### addLocal

    @Nullable
    public GridCacheMvccCandidate addLocal(long threadId,
                                                     GridCacheVersion ver,
                                                     AffinityTopologyVersion topVer,
                                                     long timeout,
                                                     boolean reenter,
                                                     boolean tx,
                                                     boolean implicitSingle,
                                                     boolean read)
                                              throws GridCacheEntryRemovedException

Add local candidate.

Parameters:
  `threadId` - Owning thread ID.
  `ver` - Lock version.
  `topVer` - Topology version.
  `timeout` - Timeout to acquire lock.
  `reenter` - Reentry flag.
  `tx` - Transaction flag.
  `implicitSingle` - Implicit flag.
  `read` - Read lock flag.
Returns:
  New candidate.
Throws:
  `GridCacheEntryRemovedException` - If entry has been removed.

#### remoteMvccSnapshot

    public Collection<GridCacheMvccCandidate> remoteMvccSnapshot(GridCacheVersion... exclude)

Gets all remote versions.

Specified by:
  `remoteMvccSnapshot` in interface `GridCacheEntryEx`
Overrides:
  `remoteMvccSnapshot` in class `GridCacheMapEntry`
Parameters:
  `exclude` - Exclude version.
Returns:
  All remote versions minus the excluded ones, if any.

#### addRemote

    public void addRemote(UUID nodeId,
                          @Nullable
                          UUID otherNodeId,
                          long threadId,
                          GridCacheVersion ver,
                          boolean tx,
                          boolean implicitSingle,
                          @Nullable
                          GridCacheVersion owned)
                   throws GridDistributedLockCancelledException,
                          GridCacheEntryRemovedException

Adds new lock candidate.

Parameters:
  `nodeId` - Node ID.
  `otherNodeId` - Other node ID.
  `threadId` - Thread ID.
  `ver` - Lock version.
  `tx` - Transaction flag.
  `implicitSingle` - Implicit flag.
  `owned` - Owned candidate version.
Throws:
  `GridDistributedLockCancelledException` - If lock has been canceled.
  `GridCacheEntryRemovedException` - If this entry is obsolete.

#### removeExplicitNodeLocks

    public void removeExplicitNodeLocks(UUID nodeId)
                                 throws GridCacheEntryRemovedException

Removes all lock candidates for node.

Parameters:
  `nodeId` - ID of node to remove locks from.
Throws:
  `GridCacheEntryRemovedException` - If entry was removed.

#### removeLock

    @Nullable
    public GridCacheMvccCandidate removeLock()

Unlocks local lock.

Returns:
  Removed candidate, or `null` if thread still holds the lock.

#### removeLock

    public boolean removeLock(GridCacheVersion ver)
                       throws GridCacheEntryRemovedException

Parameters:
  `ver` - Removes lock.
Returns:
  `True` If lock has been removed.
Throws:
  `GridCacheEntryRemovedException` - If this entry has been removed from cache.

#### checkRemoved

    protected void checkRemoved(GridCacheVersion ver)
                         throws GridDistributedLockCancelledException

Parameters:
  `ver` - Lock version.
Throws:
  `GridDistributedLockCancelledException` - If lock is cancelled.

#### addRemoved

    public boolean addRemoved(GridCacheVersion ver)

Parameters:
  `ver` - Lock version.
Returns:
  `True` if removed.

#### readyLock

    @Nullable
    public CacheLockCandidates readyLock(GridCacheVersion ver)
                                            throws GridCacheEntryRemovedException

Parameters:
  `ver` - Version of candidate to acquire lock for.
Returns:
  Owner.
Throws:
  `GridCacheEntryRemovedException` - If entry is removed.

#### readyNearLock

    public void readyNearLock(GridCacheVersion ver,
                              GridCacheVersion mapped,
                              Collection<GridCacheVersion> committed,
                              Collection<GridCacheVersion> rolledBack,
                              Collection<GridCacheVersion> pending)
                       throws GridCacheEntryRemovedException

Notifies mvcc that near local lock is ready to be acquired.

Parameters:
  `ver` - Lock version.
  `mapped` - Mapped dht lock version.
  `committed` - Committed versions.
  `rolledBack` - Rolled back versions.
  `pending` - Pending locks on dht node with version less then mapped.
Throws:
  `GridCacheEntryRemovedException` - If entry is removed.

#### doneRemote

    public void doneRemote(GridCacheVersion lockVer,
                           GridCacheVersion baseVer,
                           @Nullable
                           Collection<GridCacheVersion> pendingVers,
                           Collection<GridCacheVersion> committedVers,
                           Collection<GridCacheVersion> rolledbackVers,
                           boolean sysInvalidate)
                    throws GridCacheEntryRemovedException

Parameters:
  `lockVer` - Done version.
  `baseVer` - Base version.
  `pendingVers` - Pending versions that are less than lock version.
  `committedVers` - Completed versions for reordering.
  `rolledbackVers` - Rolled back versions for reordering.
  `sysInvalidate` - Flag indicating if this entry is done from invalidated transaction (in case of tx salvage). In this case all locks before salvaged lock will marked as used and corresponding transactions will be invalidated.
Throws:
  `GridCacheEntryRemovedException` - If entry has been removed.

#### recheck

    public void recheck()

Rechecks if lock should be reassigned.

#### tmLock

    public boolean tmLock(IgniteInternalTx tx,
                          long timeout,
                          @Nullable
                          GridCacheVersion serOrder,
                          GridCacheVersion serReadVer,
                          boolean read)
                   throws GridCacheEntryRemovedException,
                          GridDistributedLockCancelledException

This locks is called by transaction manager during prepare step for optimistic transactions.

Parameters:
  `tx` - Cache transaction.
  `timeout` - Timeout for lock acquisition.
  `serOrder` - Version for serializable transactions ordering.
  `serReadVer` - Optional read entry version for optimistic serializable transaction.
  `read` - Read lock flag.
Returns:
  `True` if lock was acquired, `false` otherwise.
Throws:
  `GridCacheEntryRemovedException` - If this entry is obsolete.
  `GridDistributedLockCancelledException` - If lock has been cancelled.

#### txUnlock

    public final void txUnlock(IgniteInternalTx tx)
                        throws GridCacheEntryRemovedException

Unlocks acquired lock.

Parameters:
  `tx` - Cache transaction.
Throws:
  `GridCacheEntryRemovedException` - If this entry has been removed from cache.

#### checkCallbacks

    protected void checkCallbacks(boolean emptyBefore,
                                  boolean emptyAfter)

Parameters:
  `emptyBefore` - Empty flag before operation.
  `emptyAfter` - Empty flag after operation.

#### checkThreadChain

    protected final void checkThreadChain(GridCacheMvccCandidate owner)

Specified by:
  `checkThreadChain` in class `GridCacheMapEntry`
Parameters:
  `owner` - Starting candidate in the chain.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridCacheMapEntry`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019