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, DFLT_LOCK_TIMEOUT_ENV, ENTRY_LOCK_TIMEOUT_ENV, flags, key, log, logRef, val, ver
-
-
Constructor Summary
Constructors Constructor Description GridDistributedCacheEntry(GridCacheContext ctx, KeyCacheObject key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable GridCacheMvccCandidateaddLocal(long threadId, GridCacheVersion ver, AffinityTopologyVersion topVer, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean read)Add local candidate.voidaddRemote(UUID nodeId, @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, boolean tx, boolean implicitSingle, @Nullable GridCacheVersion owned)Adds new lock candidate.booleanaddRemoved(GridCacheVersion ver)protected voidcheckCallbacks(boolean emptyBefore, boolean emptyAfter)protected voidcheckRemoved(GridCacheVersion ver)protected voidcheckThreadChain(GridCacheMvccCandidate owner)voiddoneRemote(GridCacheVersion lockVer, GridCacheVersion baseVer, @Nullable Collection<GridCacheVersion> pendingVers, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, boolean sysInvalidate)@Nullable CacheLockCandidatesreadyLock(GridCacheVersion ver)voidreadyNearLock(GridCacheVersion ver, GridCacheVersion mapped, Collection<GridCacheVersion> committed, Collection<GridCacheVersion> rolledBack, Collection<GridCacheVersion> pending)Notifies mvcc that near local lock is ready to be acquired.booleanrecheck(GridCacheVersion ver)Rechecks if lock should be reassigned.Collection<GridCacheMvccCandidate>remoteMvccSnapshot(GridCacheVersion... exclude)Gets all remote versions.voidremoveExplicitNodeLocks(UUID nodeId)Removes all lock candidates for node.@Nullable GridCacheMvccCandidateremoveLock()Unlocks local lock.booleanremoveLock(GridCacheVersion ver)booleantmLock(IgniteInternalTx tx, long timeout, @Nullable GridCacheVersion serOrder, GridCacheVersion serReadVer, boolean read)This locks is called by transaction manager during prepare step for optimistic transactions.StringtoString()-
Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheMapEntry
candidate, candidate, checkObsolete, checkOwnerChanged, 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, invalidate, isDht, isInternal, isLocal, isNear, isNew, isNewLocked, isReplicated, isStartVersion, key, keyValue, localCandidate, localCandidates, localOwner, localPartition, lockedBy, lockedByAny, lockedByCurrentThread, lockedByThread, lockedByThread, lockedByThread, lockedByThreadUnsafe, lockedByUnsafe, lockedLocally, lockedLocallyByIdOrThread, lockedLocallyUnsafe, lockEntry, logTxUpdate, logUpdate, markObsolete, markObsolete0, markObsoleteIfEmpty, markObsoleteVersion, memorySize, mvccAllLocal, mvccExtras, mvccExtras, nextPartitionCounter, 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, toStringWithTryLock, touch, tryLockEntry, ttl, ttlAndExpireTimeExtras, ttlExtras, txKey, txUnlock, unlockEntry, unswap, unswap, unswap, unswap, update, updateIndex, updatePlatformCache, updateTtl, 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, removeAllMeta, removeMeta, removeMeta, replaceMeta
-
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 @Nullable 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:
remoteMvccSnapshotin interfaceGridCacheEntryEx- Overrides:
remoteMvccSnapshotin classGridCacheMapEntry- Parameters:
exclude- Exclude version.- Returns:
- All remote versions minus the excluded ones, if any.
-
addRemote
public void addRemote(UUID nodeId, @Nullable @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, boolean tx, boolean implicitSingle, @Nullable @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 @Nullable 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:
TrueIf 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:
Trueif removed.
-
readyLock
@Nullable public @Nullable 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 @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 boolean recheck(GridCacheVersion ver)
Rechecks if lock should be reassigned.- Parameters:
ver- Thread chain version.- Returns:
Trueif thread chain processing must be stopped.
-
tmLock
public boolean tmLock(IgniteInternalTx tx, long timeout, @Nullable @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:
Trueif lock was acquired,falseotherwise.- Throws:
GridCacheEntryRemovedException- If this entry is obsolete.GridDistributedLockCancelledException- If lock has been cancelled.
-
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:
checkThreadChainin classGridCacheMapEntry- Parameters:
owner- Starting candidate in the chain.
-
toString
public String toString()
- Overrides:
toStringin classGridCacheMapEntry
-
-