Class GridNearCacheEntry
- 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
-
- org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry
-
- All Implemented Interfaces:
GridCacheEntryEx
public class GridNearCacheEntry extends GridDistributedCacheEntry
Near cache entry.
-
-
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 GridNearCacheEntry(GridCacheContext ctx, KeyCacheObject key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GridCacheMvccCandidateaddLocal(long threadId, GridCacheVersion ver, AffinityTopologyVersion topVer, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean read)Add local candidate.@Nullable GridCacheMvccCandidatedhtNodeId(GridCacheVersion ver, UUID dhtNodeId)@Nullable GridCacheVersiondhtVersion()protected booleanevictionDisabled()voidinitializeFromDht(AffinityTopologyVersion topVer)booleanisNear()booleanloadedValue(@Nullable IgniteInternalTx tx, UUID primaryNodeId, CacheObject val, GridCacheVersion ver, GridCacheVersion dhtVer, long ttl, long expireTime, boolean evt, boolean keepBinary, AffinityTopologyVersion topVer)protected WALPointerlogTxUpdate(IgniteInternalTx tx, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr)protected voidlogUpdate(GridCacheOperation op, CacheObject val, GridCacheVersion ver, long expireTime, long updCntr, boolean primary)intmemorySize()protected voidonInvalidate()Called when entry invalidated.voidonMarkedObsolete()This method should be called each time entry is marked obsolete other than by callingGridCacheEntryEx.markObsolete(GridCacheVersion).intpartition()protected ObjectreadThrough(IgniteInternalTx tx, KeyCacheObject key, boolean reload, String taskName)booleanrecordDhtVersion(GridCacheVersion dhtVer)protected voidrecordNodeId(UUID primaryNodeId, AffinityTopologyVersion topVer)@Nullable GridCacheMvccCandidateremoveLock()Unlocks local lock.protected voidremoveValue()Removes value from offheap.booleanresetFromPrimary(CacheObject val, GridCacheVersion ver, GridCacheVersion dhtVer, UUID primaryNodeId, AffinityTopologyVersion topVer)This method should be called only when lock is owned on this entry.protected booleanstoreValue(CacheObject val, long expireTime, GridCacheVersion ver)Stores value in offheap.StringtoString()@Nullable CacheDataRowunswap(CacheDataRow row, boolean checkExpire)Unswaps an entry.voidupdateOrEvict(GridCacheVersion dhtVer, @Nullable CacheObject val, long expireTime, long ttl, UUID primaryNodeId, AffinityTopologyVersion topVer)This method should be called only when lock is owned on this entry.booleanvalid(AffinityTopologyVersion topVer)@Nullable IgniteBiTuple<GridCacheVersion,CacheObject>versionedValue()-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry
addRemote, addRemoved, checkCallbacks, checkRemoved, checkThreadChain, doneRemote, readyLock, readyNearLock, recheck, remoteMvccSnapshot, removeExplicitNodeLocks, removeLock, tmLock
-
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, expireTime, expireTimeExtras, expireTimeUnlocked, hashCode, hasLockCandidate, hasLockCandidate, hasLockCandidateUnsafe, hasReaders, hasValue, hasValueUnlocked, incrementMapPublicSize, info, initialValue, innerGet, innerGetAndReserveForLoad, innerGetVersioned, innerReload, innerRemove, innerSet, innerUpdate, invalidate, isDht, isInternal, isLocal, isNew, isNewLocked, isReplicated, isStartVersion, key, keyValue, localCandidate, localCandidates, localOwner, localPartition, lockedBy, lockedByAny, lockedByCurrentThread, lockedByThread, lockedByThread, lockedByThread, lockedByThreadUnsafe, lockedByUnsafe, lockedLocally, lockedLocallyByIdOrThread, lockedLocallyUnsafe, lockEntry, markObsolete, markObsolete0, markObsoleteIfEmpty, markObsoleteVersion, mvccAllLocal, mvccExtras, mvccExtras, nextPartitionCounter, nextPartitionCounter, obsolete, obsolete, obsoleteOrDeleted, obsoleteVersion, obsoleteVersionExtras, onTtlExpired, onUnlock, onUpdateFinished, partitionValid, peek, peek, peekVisibleValue, rawExpireTime, rawGet, rawPut, rawTtl, storeValue, toStringWithTryLock, touch, tryLockEntry, ttl, ttlAndExpireTimeExtras, ttlExtras, txKey, txUnlock, unlockEntry, unswap, unswap, unswap, update, updateIndex, updatePlatformCache, updateTtl, updateTtl, 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
-
GridNearCacheEntry
public GridNearCacheEntry(GridCacheContext ctx, KeyCacheObject key)
- Parameters:
ctx- Cache context.key- Cache key.
-
-
Method Detail
-
memorySize
public int memorySize() throws IgniteCheckedException- Specified by:
memorySizein interfaceGridCacheEntryEx- Overrides:
memorySizein classGridCacheMapEntry- Returns:
- Memory size.
- Throws:
IgniteCheckedException- If failed.
-
partition
public int partition()
- Specified by:
partitionin interfaceGridCacheEntryEx- Overrides:
partitionin classGridCacheMapEntry- Returns:
- Partition ID.
-
isNear
public boolean isNear()
- Specified by:
isNearin interfaceGridCacheEntryEx- Overrides:
isNearin classGridCacheMapEntry- Returns:
Trueif near.
-
valid
public boolean valid(AffinityTopologyVersion topVer)
- Specified by:
validin interfaceGridCacheEntryEx- Overrides:
validin classGridCacheMapEntry- Parameters:
topVer- Topology version where validation should be performed. When negative the latest available topology should be used.- Returns:
- Checks if value is valid.
-
initializeFromDht
public void initializeFromDht(AffinityTopologyVersion topVer) throws GridCacheEntryRemovedException
- Parameters:
topVer- Topology version.- Throws:
GridCacheEntryRemovedException- If this entry is obsolete.
-
resetFromPrimary
public boolean resetFromPrimary(CacheObject val, GridCacheVersion ver, GridCacheVersion dhtVer, UUID primaryNodeId, AffinityTopologyVersion topVer) throws GridCacheEntryRemovedException
This method should be called only when lock is owned on this entry.- Parameters:
val- Value.ver- Version.dhtVer- DHT version.primaryNodeId- Primary node ID.topVer- Topology version.- Returns:
Trueif reset was done.- Throws:
GridCacheEntryRemovedException- If obsolete.
-
updateOrEvict
public void updateOrEvict(GridCacheVersion dhtVer, @Nullable @Nullable CacheObject val, long expireTime, long ttl, UUID primaryNodeId, AffinityTopologyVersion topVer)
This method should be called only when lock is owned on this entry.- Parameters:
dhtVer- DHT version.val- Value associated with version.expireTime- Expire time.ttl- Time to live.primaryNodeId- Primary node ID.topVer- Topology version.
-
dhtVersion
@Nullable public @Nullable GridCacheVersion dhtVersion() throws GridCacheEntryRemovedException
- Returns:
- DHT version for this entry.
- Throws:
GridCacheEntryRemovedException- If obsolete.
-
versionedValue
@Nullable public @Nullable IgniteBiTuple<GridCacheVersion,CacheObject> versionedValue() throws GridCacheEntryRemovedException
- Returns:
- Tuple with version and value of this entry.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
recordNodeId
protected void recordNodeId(UUID primaryNodeId, AffinityTopologyVersion topVer)
- Overrides:
recordNodeIdin classGridCacheMapEntry- Parameters:
primaryNodeId- Node ID.
-
recordDhtVersion
public final boolean recordDhtVersion(GridCacheVersion dhtVer)
- Parameters:
dhtVer- DHT version to record.- Returns:
Falseif given version is lower then existing version.
-
readThrough
protected Object readThrough(IgniteInternalTx tx, KeyCacheObject key, boolean reload, String taskName) throws IgniteCheckedException
- Overrides:
readThroughin classGridCacheMapEntry- Parameters:
tx- Transaction.key- Key.reload- flag.taskName- Task name.- Returns:
- Read value.
- Throws:
IgniteCheckedException- If failed.
-
loadedValue
public boolean loadedValue(@Nullable @Nullable IgniteInternalTx tx, UUID primaryNodeId, CacheObject val, GridCacheVersion ver, GridCacheVersion dhtVer, long ttl, long expireTime, boolean evt, boolean keepBinary, AffinityTopologyVersion topVer) throws IgniteCheckedException, GridCacheEntryRemovedException- Parameters:
tx- Transaction.primaryNodeId- Primary node ID.val- New value.ver- Version to use.dhtVer- DHT version received from remote node.ttl- Time to live.expireTime- Expiration time.evt- Event flag.topVer- Topology version.- Returns:
Trueif initial value was set.- Throws:
IgniteCheckedException- In case of error.GridCacheEntryRemovedException- If entry was removed.
-
storeValue
protected boolean storeValue(CacheObject val, long expireTime, GridCacheVersion ver)
Stores value in offheap.- Overrides:
storeValuein classGridCacheMapEntry- Parameters:
val- Value.expireTime- Expire time.ver- New entry version.
-
removeValue
protected void removeValue()
Removes value from offheap.- Overrides:
removeValuein classGridCacheMapEntry
-
logUpdate
protected void logUpdate(GridCacheOperation op, CacheObject val, GridCacheVersion ver, long expireTime, long updCntr, boolean primary)
- Overrides:
logUpdatein classGridCacheMapEntry- Parameters:
op- Update operation.val- Write value.ver- Write version.expireTime- Expire time.updCntr- Update counter.primary-Trueif node is primary for entry in the moment of logging.
-
logTxUpdate
protected WALPointer logTxUpdate(IgniteInternalTx tx, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr)
- Overrides:
logTxUpdatein classGridCacheMapEntry- Parameters:
tx- Transaction.val- Value.writeVer- New entry version.expireTime- Expire time (or 0 if not applicable).updCntr- Update counter.
-
unswap
@Nullable public @Nullable CacheDataRow unswap(CacheDataRow row, boolean checkExpire)
Unswaps an entry.- Overrides:
unswapin classGridCacheMapEntry- Parameters:
row- Already extracted cache data.checkExpire- Iftruechecks for expiration, as result entry can be obsoleted or marked deleted.- Returns:
- Value.
-
addLocal
public GridCacheMvccCandidate addLocal(long threadId, GridCacheVersion ver, AffinityTopologyVersion topVer, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean read) throws GridCacheEntryRemovedException
Add local candidate.- Overrides:
addLocalin classGridDistributedCacheEntry- 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.
-
dhtNodeId
@Nullable public @Nullable GridCacheMvccCandidate dhtNodeId(GridCacheVersion ver, UUID dhtNodeId) throws GridCacheEntryRemovedException
- Parameters:
ver- Version to set DHT node ID for.dhtNodeId- DHT node ID.- Returns:
trueif candidate was found.- Throws:
GridCacheEntryRemovedException- If entry is removed.
-
removeLock
@Nullable public @Nullable GridCacheMvccCandidate removeLock()
Unlocks local lock.- Overrides:
removeLockin classGridDistributedCacheEntry- Returns:
- Removed candidate, or null if thread still holds the lock.
-
onInvalidate
protected void onInvalidate()
Called when entry invalidated.- Overrides:
onInvalidatein classGridCacheMapEntry
-
evictionDisabled
protected boolean evictionDisabled()
- Overrides:
evictionDisabledin classGridCacheMapEntry- Returns:
Trueif this entry should not be evicted from cache.
-
onMarkedObsolete
public void onMarkedObsolete()
This method should be called each time entry is marked obsolete other than by callingGridCacheEntryEx.markObsolete(GridCacheVersion).- Specified by:
onMarkedObsoletein interfaceGridCacheEntryEx- Overrides:
onMarkedObsoletein classGridCacheMapEntry
-
toString
public String toString()
- Overrides:
toStringin classGridDistributedCacheEntry
-
-