Class GridCacheMapEntry
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
-
- org.apache.ignite.internal.processors.cache.GridCacheMapEntry
-
- All Implemented Interfaces:
GridCacheEntryEx
- Direct Known Subclasses:
GridDistributedCacheEntry
public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter implements GridCacheEntryEx
Adapter for cache entry.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
GridMetadataAwareAdapter.EntryKey
-
-
Field Summary
Fields Modifier and Type Field Description static GridCacheAtomicVersionComparatorATOMIC_VER_COMPARATORprotected GridCacheContext<?,?>cctxCache registry.static intDFLT_LOCK_TIMEOUT_ENVstatic StringENTRY_LOCK_TIMEOUT_ENVProperty name for entry lock timeout in milliseconds.protected byteflagsFlags: Deleted flag - maskIS_DELETED_MASKUnswapped flag - maskIS_UNSWAPPED_MASKprotected KeyCacheObjectkeyKey.protected static IgniteLoggerlogLogger.protected static AtomicReference<IgniteLogger>logRefStatic logger to avoid re-creation.protected CacheObjectvalValue.protected GridCacheVersionverVersion.
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridCacheMapEntry(GridCacheContext<?,?> cctx, KeyCacheObject key)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description GridCacheMvccCandidatecandidate(UUID nodeId, long threadId)@Nullable GridCacheMvccCandidatecandidate(GridCacheVersion ver)Gets lock candidate for given lock ID.protected voidcheckObsolete()protected voidcheckOwnerChanged(@Nullable CacheLockCandidates prevOwners, @Nullable CacheLockCandidates owners, CacheObject val)protected voidcheckOwnerChanged(@Nullable CacheLockCandidates prevOwners, @Nullable CacheLockCandidates owners, CacheObject val, boolean inThreadChain)booleancheckSerializableReadVersion(GridCacheVersion serReadVer)Checks if there was read/write conflict in serializable transaction.protected abstract voidcheckThreadChain(GridCacheMvccCandidate owner)booleanclear(GridCacheVersion ver, boolean readers)Marks entry as obsolete and, if possible or required, removes it from swap storage.protected voidclearReader(UUID nodeId)protected voidclearReaders()voidclearReserveForLoad(GridCacheVersion ver)<K,V>
GridCacheContext<K,V>context()protected voiddecrementMapPublicSize()Decrements public size of map.booleandeleted()Note: this method works only for cache configured in ATOMIC mode or for cache that is data center replication target.protected booleandeletedUnlocked()protected voiddeletedUnlocked(boolean deleted)booleandetached()booleanequals(Object o)booleanevictInternal(GridCacheVersion obsoleteVer, @Nullable CacheEntryPredicate[] filter, boolean evictOffheap)protected booleanevictionDisabled()longexpireTime()longexpireTimeExtras()longexpireTimeUnlocked()inthashCode()booleanhasLockCandidate(long threadId)Checks if the candidate is either owner or pending.booleanhasLockCandidate(GridCacheVersion ver)Checks if the candidate is either owner or pending.booleanhasLockCandidateUnsafe(GridCacheVersion ver)protected booleanhasReaders()booleanhasValue()protected booleanhasValueUnlocked()protected voidincrementMapPublicSize()Increments public size of map.@Nullable GridCacheEntryInfoinfo()booleaninitialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary, CacheDataRow row)Sets new value if current version is 0CacheObjectinnerGet(@Nullable GridCacheVersion ver, @Nullable IgniteInternalTx tx, boolean readThrough, boolean updateMetrics, boolean evt, Object transformClo, String taskName, @Nullable IgniteCacheExpiryPolicy expirePlc, boolean keepBinary)EntryGetResultinnerGetAndReserveForLoad(boolean updateMetrics, boolean evt, String taskName, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary, @Nullable ReaderArguments readerArgs)EntryGetResultinnerGetVersioned(@Nullable GridCacheVersion ver, IgniteInternalTx tx, boolean updateMetrics, boolean evt, Object transformClo, String taskName, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary, @Nullable ReaderArguments readerArgs)@Nullable CacheObjectinnerReload()Reloads entry from underlying storage.GridCacheUpdateTxResultinnerRemove(@Nullable IgniteInternalTx tx, UUID evtNodeId, UUID affNodeId, boolean retval, boolean evt, boolean metrics, boolean keepBinary, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, GridDrType drType, @Nullable GridCacheVersion explicitVer, String taskName, @Nullable GridCacheVersion dhtVer, @Nullable Long updateCntr)GridCacheUpdateTxResultinnerSet(@Nullable IgniteInternalTx tx, UUID evtNodeId, UUID affNodeId, CacheObject val, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, boolean keepBinary, boolean oldValPresent, @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, GridDrType drType, long drExpireTime, @Nullable GridCacheVersion explicitVer, String taskName, @Nullable GridCacheVersion dhtVer, @Nullable Long updateCntr)GridCacheUpdateAtomicResultinnerUpdate(GridCacheVersion newVer, UUID evtNodeId, UUID affNodeId, GridCacheOperation op, @Nullable Object writeObj, @Nullable Object[] invokeArgs, boolean writeThrough, boolean readThrough, boolean retval, boolean keepBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, boolean primary, boolean verCheck, boolean readRepairRecovery, AffinityTopologyVersion topVer, @Nullable CacheEntryPredicate[] filter, GridDrType drType, long explicitTtl, long explicitExpireTime, @Nullable GridCacheVersion conflictVer, boolean conflictResolve, boolean intercept, String taskName, @Nullable CacheObject prevVal, @Nullable Long updateCntr, @Nullable GridDhtAtomicAbstractUpdateFuture fut, boolean transformOp)booleaninvalidate(GridCacheVersion newVer)Invalidates this entry.booleanisDht()booleanisInternal()booleanisLocal()booleanisNear()booleanisNew()Checks if entry is new assuming lock is held externally.booleanisNewLocked()Checks if entry is new while holding lock.booleanisReplicated()booleanisStartVersion()KeyCacheObjectkey()protected ObjectkeyValue(boolean cpy)GridCacheMvccCandidatelocalCandidate(long threadId)Collection<GridCacheMvccCandidate>localCandidates(GridCacheVersion... exclude)Gets all local candidates.GridCacheMvccCandidatelocalOwner()protected GridDhtLocalPartitionlocalPartition()booleanlockedBy(GridCacheVersion ver)booleanlockedByAny(GridCacheVersion... exclude)booleanlockedByCurrentThread()Tests whether the entry is locked currently.booleanlockedByThread()booleanlockedByThread(long threadId)booleanlockedByThread(long threadId, GridCacheVersion exclude)booleanlockedByThreadUnsafe(long threadId)Will not fail for removed entries.booleanlockedByUnsafe(GridCacheVersion ver)booleanlockedLocally(GridCacheVersion lockVer)booleanlockedLocallyByIdOrThread(GridCacheVersion lockVer, long threadId)booleanlockedLocallyUnsafe(GridCacheVersion lockVer)voidlockEntry()Locks entry to protect from concurrent access.protected WALPointerlogTxUpdate(IgniteInternalTx tx, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr)protected voidlogUpdate(GridCacheOperation op, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr, boolean primary)booleanmarkObsolete(GridCacheVersion ver)Sets obsolete flag if possible.protected booleanmarkObsolete0(GridCacheVersion ver, boolean clear, GridCacheObsoleteEntryExtras extras)Note thatonMarkedObsolete()should always be called after this method returnstrue.booleanmarkObsoleteIfEmpty(@Nullable GridCacheVersion obsoleteVer)Sets obsolete flag if entry value isnullor entry is expired and no locks are held.booleanmarkObsoleteVersion(GridCacheVersion ver)Sets obsolete flag if entry version equals tover.intmemorySize()@Nullable List<GridCacheMvccCandidate>mvccAllLocal()protected @Nullable GridCacheMvccmvccExtras()protected voidmvccExtras(@Nullable GridCacheMvcc mvcc)protected longnextPartitionCounter(AffinityTopologyVersion topVer, boolean primary, boolean initial, @Nullable Long primaryCntr)protected longnextPartitionCounter(IgniteInternalTx tx, @Nullable Long updateCntr)booleanobsolete()booleanobsolete(GridCacheVersion exclude)booleanobsoleteOrDeleted()GridCacheVersionobsoleteVersion()protected @Nullable GridCacheVersionobsoleteVersionExtras()protected voidonInvalidate()Called when entry invalidated.voidonMarkedObsolete()This method should be called each time entry is marked obsolete other than by callingGridCacheEntryEx.markObsolete(GridCacheVersion).booleanonTtlExpired(GridCacheVersion obsoleteVer)Callback from ttl processor to cache entry indicating that entry is expired.voidonUnlock()CallsGridDhtLocalPartition.onUnlock()for this entry's partition.protected voidonUpdateFinished(long cntr)intpartition()booleanpartitionValid()@Nullable CacheObjectpeek()Peeks into entry without loading value or updating statistics.@Nullable CacheObjectpeek(boolean heap, boolean offheap, AffinityTopologyVersion topVer, @Nullable IgniteCacheExpiryPolicy expiryPlc)Peeks into entry without loading value or updating statistics.@Nullable CacheObjectpeekVisibleValue()Peeks value provided to public API entries and to entry filters.longrawExpireTime()CacheObjectrawGet()CacheObjectrawPut(CacheObject val, long ttl)longrawTtl()protected @Nullable ObjectreadThrough(@Nullable IgniteInternalTx tx, KeyCacheObject key, boolean reload, String taskName)protected voidrecordNodeId(UUID nodeId, AffinityTopologyVersion topVer)Collection<GridCacheMvccCandidate>remoteMvccSnapshot(GridCacheVersion... exclude)Gets all remote versions.protected voidremoveValue()Removes value from offheap.protected booleanstoreValue(@Nullable CacheObject val, long expireTime, GridCacheVersion ver)Stores value in offheap.protected booleanstoreValue(@Nullable CacheObject val, long expireTime, GridCacheVersion ver, @Nullable IgnitePredicate<CacheDataRow> predicate, @Nullable CacheDataRow row)Stores value in off-heap.StringtoString()protected StringtoStringWithTryLock(Supplier<String> dfltToStr)Does thread safetoString()forGridCacheMapEntryclasses.voidtouch()Touch this entry in its context's eviction manager.booleantryLockEntry(long timeout)Locks entry to protect from concurrent access.longttl()protected voidttlAndExpireTimeExtras(long ttl, long expireTime)longttlExtras()IgniteTxKeytxKey()voidtxUnlock(IgniteInternalTx tx)Unlocks acquired lock.voidunlockEntry()Unlocks entry previously locked byGridCacheEntryEx.lockEntry().CacheObjectunswap()@Nullable CacheObjectunswap(boolean needVal)Unswap ignoring flags.protected @Nullable CacheDataRowunswap(@Nullable CacheDataRow row, boolean checkExpire)Unswaps an entry.CacheObjectunswap(CacheDataRow row)protected voidupdate(@Nullable CacheObject val, long expireTime, long ttl, GridCacheVersion ver, boolean addTracked)voidupdateIndex(SchemaIndexCacheVisitorClosure clo)Update index from within entry lock, passing key, value, and expiration time to provided closure.protected voidupdatePlatformCache(@Nullable CacheObject val, @Nullable AffinityTopologyVersion ver)Invokes platform cache update callback, if applicable.voidupdateTtl(@Nullable GridCacheVersion ver, long ttl)voidupdateTtl(GridCacheVersion ver, IgniteCacheExpiryPolicy expiryPlc)booleanvalid(AffinityTopologyVersion topVer)protected voidvalue(@Nullable CacheObject val)Sets entry value.CacheObjectvalueBytes()@Nullable CacheObjectvalueBytes(@Nullable GridCacheVersion ver)Gets cached serialized value bytes.protected IgniteBiTuple<byte[],Byte>valueBytes0()GridCacheVersionversion()GridCacheVersionedEntryExversionedEntry(boolean keepBinary)Create versioned entry for this cache entry.EntryGetResultversionedValue(CacheObject val, GridCacheVersion curVer, GridCacheVersion newVer, @Nullable IgniteCacheExpiryPolicy loadExpiryPlc, @Nullable ReaderArguments readerArgs)Sets new value if passed in version matches the current version (used for read-through only).booleanvisitable(CacheEntryPredicate[] filter)<K,V>
javax.cache.Cache.Entry<K,V>wrap()Wraps this map entry into cache entry.<K,V>
EvictableEntry<K,V>wrapEviction()<K,V>
javax.cache.Cache.Entry<K,V>wrapLazyValue(boolean keepBinary)Wraps entry to an entry with lazy value get.<K,V>
CacheEntryImplEx<K,V>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, removeLock, removeMeta, removeMeta, replaceMeta, tmLock
-
-
-
-
Field Detail
-
ATOMIC_VER_COMPARATOR
public static final GridCacheAtomicVersionComparator ATOMIC_VER_COMPARATOR
-
DFLT_LOCK_TIMEOUT_ENV
public static final int DFLT_LOCK_TIMEOUT_ENV
- See Also:
ENTRY_LOCK_TIMEOUT, Constant Field Values
-
ENTRY_LOCK_TIMEOUT_ENV
@SystemProperty(value="Sets the entry\'s lock timeout in milliseconds", type=java.lang.Long.class, defaults="1000") public static final String ENTRY_LOCK_TIMEOUT_ENV
Property name for entry lock timeout in milliseconds. Default is 1000.- See Also:
- Constant Field Values
-
logRef
protected static final AtomicReference<IgniteLogger> logRef
Static logger to avoid re-creation. Made static for test purpose.
-
log
protected static volatile IgniteLogger log
Logger.
-
cctx
@GridToStringExclude protected final GridCacheContext<?,?> cctx
Cache registry.
-
key
@GridToStringInclude(sensitive=true) protected final KeyCacheObject key
Key.
-
val
@GridToStringInclude(sensitive=true) protected CacheObject val
Value.
-
ver
@GridToStringInclude protected GridCacheVersion ver
Version.
-
flags
@GridToStringInclude protected byte flags
Flags:- Deleted flag - mask
IS_DELETED_MASK - Unswapped flag - mask
IS_UNSWAPPED_MASK
- Deleted flag - mask
-
-
Constructor Detail
-
GridCacheMapEntry
protected GridCacheMapEntry(GridCacheContext<?,?> cctx, KeyCacheObject key)
- Parameters:
cctx- Cache context.key- Cache key.
-
-
Method Detail
-
value
protected void value(@Nullable @Nullable CacheObject val)Sets entry value. If off-heap value storage is enabled, will serialize value to off-heap.- Parameters:
val- Value to store.
-
memorySize
public int memorySize() throws IgniteCheckedException- Specified by:
memorySizein interfaceGridCacheEntryEx- Returns:
- Memory size.
- Throws:
IgniteCheckedException- If failed.
-
isInternal
public boolean isInternal()
- Specified by:
isInternalin interfaceGridCacheEntryEx- Returns:
Trueif entry is internal cache entry.
-
isDht
public boolean isDht()
- Specified by:
isDhtin interfaceGridCacheEntryEx- Returns:
Trueif DHT.
-
isLocal
public boolean isLocal()
- Specified by:
isLocalin interfaceGridCacheEntryEx- Returns:
Trueif local.
-
isNear
public boolean isNear()
- Specified by:
isNearin interfaceGridCacheEntryEx- Returns:
Trueif near.
-
isReplicated
public boolean isReplicated()
- Specified by:
isReplicatedin interfaceGridCacheEntryEx- Returns:
Trueif replicated.
-
detached
public boolean detached()
- Specified by:
detachedin interfaceGridCacheEntryEx- Returns:
Falseif entry belongs to cache map,trueif this entry was created in colocated cache and node is not primary for this key.
-
context
public <K,V> GridCacheContext<K,V> context()
- Specified by:
contextin interfaceGridCacheEntryEx- Returns:
- Context.
-
isNew
public boolean isNew() throws GridCacheEntryRemovedExceptionChecks if entry is new assuming lock is held externally.- Specified by:
isNewin interfaceGridCacheEntryEx- Returns:
Trueif entry is new.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
isNewLocked
public boolean isNewLocked() throws GridCacheEntryRemovedExceptionChecks if entry is new while holding lock.- Specified by:
isNewLockedin interfaceGridCacheEntryEx- Returns:
Trueif entry is new.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
isStartVersion
public boolean isStartVersion()
- Returns:
Trueif start version.
-
valid
public boolean valid(AffinityTopologyVersion topVer)
- Specified by:
validin interfaceGridCacheEntryEx- Parameters:
topVer- Topology version where validation should be performed. When negative the latest available topology should be used.- Returns:
- Checks if value is valid.
-
partition
public int partition()
- Specified by:
partitionin interfaceGridCacheEntryEx- Returns:
- Partition ID.
-
localPartition
protected GridDhtLocalPartition localPartition()
- Returns:
- Local partition that owns this entry.
-
partitionValid
public boolean partitionValid()
- Specified by:
partitionValidin interfaceGridCacheEntryEx- Returns:
Trueif partition is in valid.
-
info
@Nullable public @Nullable GridCacheEntryInfo info()
- Specified by:
infoin interfaceGridCacheEntryEx- Returns:
- Entry info.
-
unswap
public final CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
unswapin interfaceGridCacheEntryEx- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed to read from swap storage.GridCacheEntryRemovedException- If entry was removed.
-
unswap
public final CacheObject unswap(CacheDataRow row) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
unswapin interfaceGridCacheEntryEx- Parameters:
row- Already extracted value.- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed to read from swap storage.GridCacheEntryRemovedException- If entry was removed.
-
unswap
@Nullable public final @Nullable CacheObject unswap(boolean needVal) throws IgniteCheckedException, GridCacheEntryRemovedException
Unswap ignoring flags.- Specified by:
unswapin interfaceGridCacheEntryEx- Parameters:
needVal- Iffalsethen do not need to deserialize value during unswap.- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed.GridCacheEntryRemovedException- If entry was removed.
-
unswap
@Nullable protected @Nullable CacheDataRow unswap(@Nullable @Nullable CacheDataRow row, boolean checkExpire) throws IgniteCheckedException, GridCacheEntryRemovedException
Unswaps an entry.- Parameters:
row- Already extracted cache data.checkExpire- Iftruechecks for expiration, as result entry can be obsoleted or marked deleted.- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed.GridCacheEntryRemovedException- If entry was removed.
-
valueBytes0
protected IgniteBiTuple<byte[],Byte> valueBytes0()
- Returns:
- Value bytes and flag indicating whether value is byte array.
-
readThrough
@Nullable protected @Nullable Object readThrough(@Nullable @Nullable IgniteInternalTx tx, KeyCacheObject key, boolean reload, String taskName) throws IgniteCheckedException
- Parameters:
tx- Transaction.key- Key.reload- flag.taskName- Task name.- Returns:
- Read value.
- Throws:
IgniteCheckedException- If failed.
-
innerGet
public final CacheObject innerGet(@Nullable @Nullable GridCacheVersion ver, @Nullable @Nullable IgniteInternalTx tx, boolean readThrough, boolean updateMetrics, boolean evt, Object transformClo, String taskName, @Nullable @Nullable IgniteCacheExpiryPolicy expirePlc, boolean keepBinary) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
innerGetin interfaceGridCacheEntryEx- Parameters:
ver- Cache version to set. The version will be used on updating entry instead of generated one.tx- Ongoing transaction (possibly null).readThrough- Flag indicating whether to read through.updateMetrics- Iftruethen metrics should be updated.evt- Flag to signal event notification.transformClo- Transform closure to record event.taskName- Task name.expirePlc- Expiry policy.keepBinary- Keep binary flag.- Returns:
- Cached value.
- Throws:
IgniteCheckedException- If loading value failed.GridCacheEntryRemovedException- If entry was removed.
-
innerGetAndReserveForLoad
public EntryGetResult innerGetAndReserveForLoad(boolean updateMetrics, boolean evt, String taskName, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary, @Nullable @Nullable ReaderArguments readerArgs) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
innerGetAndReserveForLoadin interfaceGridCacheEntryEx- Parameters:
updateMetrics- Iftruethen metrics should be updated.evt- Flag to signal event notification.taskName- Task name.expiryPlc- Expiry policy.keepBinary- Keep binary flag.readerArgs- Reader will be added if not null.- Returns:
- Cached value, entry version and flag indicating if entry was reserved.
- Throws:
IgniteCheckedException- If loading value failed.GridCacheEntryRemovedException- If entry was removed.
-
innerGetVersioned
public EntryGetResult innerGetVersioned(@Nullable @Nullable GridCacheVersion ver, IgniteInternalTx tx, boolean updateMetrics, boolean evt, Object transformClo, String taskName, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary, @Nullable @Nullable ReaderArguments readerArgs) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
innerGetVersionedin interfaceGridCacheEntryEx- Parameters:
ver- Cache version to set. The version will be used on updating entry instead of generated one.tx- Cache transaction.updateMetrics- Iftruethen metrics should be updated.evt- Flag to signal event notification.transformClo- Transform closure to record event.taskName- Task name.expiryPlc- Expiry policy.keepBinary- Keep binary flag.readerArgs- Reader will be added if not null.- Returns:
- Cached value and entry version.
- Throws:
IgniteCheckedException- If loading value failed.GridCacheEntryRemovedException- If entry was removed.
-
innerReload
@Nullable public final @Nullable CacheObject innerReload() throws IgniteCheckedException, GridCacheEntryRemovedException
Reloads entry from underlying storage.- Specified by:
innerReloadin interfaceGridCacheEntryEx- Returns:
- Reloaded value.
- Throws:
IgniteCheckedException- If reload failed.GridCacheEntryRemovedException- If entry has been removed.
-
recordNodeId
protected void recordNodeId(UUID nodeId, AffinityTopologyVersion topVer)
- Parameters:
nodeId- Node ID.
-
innerSet
public final GridCacheUpdateTxResult innerSet(@Nullable @Nullable IgniteInternalTx tx, UUID evtNodeId, UUID affNodeId, CacheObject val, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, boolean keepBinary, boolean oldValPresent, @Nullable @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, GridDrType drType, long drExpireTime, @Nullable @Nullable GridCacheVersion explicitVer, String taskName, @Nullable @Nullable GridCacheVersion dhtVer, @Nullable @Nullable Long updateCntr) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
innerSetin interfaceGridCacheEntryEx- Parameters:
tx- Cache transaction.evtNodeId- ID of node responsible for this change.affNodeId- Partitioned node iD.val- Value to set.writeThrough- Iftruethen persist to storage.retval-Trueif value should be returned (and unmarshalled if needed).ttl- Time to live.evt- Flag to signal event notification.metrics- Flag to signal metrics update.keepBinary- Keep binary flag.oldValPresent-Trueif oldValue present.oldVal- Old value.topVer- Topology version.drType- DR type.drExpireTime- DR expire time (if any).explicitVer- Explicit version (if any).taskName- Task name.dhtVer- Dht version for near cache entry.updateCntr- Update counter.- Returns:
- Tuple containing success flag and old value. If success is
false, then value isnull. - Throws:
IgniteCheckedException- If storing value failed.GridCacheEntryRemovedException- If entry has been removed.
-
keyValue
protected Object keyValue(boolean cpy)
- Parameters:
cpy- Copy flag.- Returns:
- Key value.
-
innerRemove
public final GridCacheUpdateTxResult innerRemove(@Nullable @Nullable IgniteInternalTx tx, UUID evtNodeId, UUID affNodeId, boolean retval, boolean evt, boolean metrics, boolean keepBinary, boolean oldValPresent, @Nullable @Nullable CacheObject oldVal, AffinityTopologyVersion topVer, GridDrType drType, @Nullable @Nullable GridCacheVersion explicitVer, String taskName, @Nullable @Nullable GridCacheVersion dhtVer, @Nullable @Nullable Long updateCntr) throws IgniteCheckedException, GridCacheEntryRemovedException
- Specified by:
innerRemovein interfaceGridCacheEntryEx- Parameters:
tx- Cache transaction.evtNodeId- ID of node responsible for this change.affNodeId- Partitioned node iD.retval-Trueif value should be returned (and unmarshalled if needed).evt- Flag to signal event notification.metrics- Flag to signal metrics notification.keepBinary- Keep binary flag.oldValPresent-Trueif oldValue present.oldVal- Old value.topVer- Topology version.drType- DR type.explicitVer- Explicit version (if any).taskName- Task name.dhtVer- Dht version for near cache entry.- Returns:
- Tuple containing success flag and old value. If success is
false, then value isnull. - Throws:
IgniteCheckedException- If remove failed.GridCacheEntryRemovedException- If entry has been removed.
-
innerUpdate
public GridCacheUpdateAtomicResult innerUpdate(GridCacheVersion newVer, UUID evtNodeId, UUID affNodeId, GridCacheOperation op, @Nullable @Nullable Object writeObj, @Nullable @Nullable Object[] invokeArgs, boolean writeThrough, boolean readThrough, boolean retval, boolean keepBinary, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, boolean primary, boolean verCheck, boolean readRepairRecovery, AffinityTopologyVersion topVer, @Nullable @Nullable CacheEntryPredicate[] filter, GridDrType drType, long explicitTtl, long explicitExpireTime, @Nullable @Nullable GridCacheVersion conflictVer, boolean conflictResolve, boolean intercept, String taskName, @Nullable @Nullable CacheObject prevVal, @Nullable @Nullable Long updateCntr, @Nullable @Nullable GridDhtAtomicAbstractUpdateFuture fut, boolean transformOp) throws IgniteCheckedException, GridCacheEntryRemovedException, GridClosureException
- Specified by:
innerUpdatein interfaceGridCacheEntryEx- Parameters:
newVer- Cache version to set. Entry will be updated only if current version is less then passed version.evtNodeId- Event node ID.affNodeId- Affinity node ID.op- Update operation.writeObj- Value. Type depends on operation.invokeArgs- Optional arguments for entry processor.writeThrough- Write through flag.readThrough- Read through flag.retval- Return value flag.expiryPlc- Expiry policy.evt- Event flag.metrics- Metrics update flag.primary- If update is performed on primary node (the one which assigns version).verCheck- Whether update should check current version and ignore update if current version is greater than passed in.readRepairRecovery- Recovery on Read Repair.topVer- Topology version.filter- Optional filter to check.drType- DR type.explicitTtl- Conflict TTL (if any).explicitExpireTime- Conflict expire time (if any).conflictVer- DR version (if any).conflictResolve- Iftruethen performs conflicts resolution.intercept- Iftruethen calls cache interceptor.taskName- Task name.updateCntr- Update counter.fut- Dht atomic future.transformOp-Trueif transform operation caused update.- Returns:
- Tuple where first value is flag showing whether operation succeeded,
second value is old entry value if return value is requested, third is updated entry value,
fourth is the version to enqueue for deferred delete the fifth is DR conflict context
or
nullif conflict resolution was not performed, the last boolean - whether update should be propagated to backups or not. - Throws:
IgniteCheckedException- If update failed.GridCacheEntryRemovedException- If entry is obsolete.GridClosureException
-
hasReaders
protected boolean hasReaders() throws GridCacheEntryRemovedException- Returns:
trueif entry has readers. It makes sense only for dht entry.- Throws:
GridCacheEntryRemovedException- If removed.
-
clearReaders
protected void clearReaders()
-
clearReader
protected void clearReader(UUID nodeId) throws GridCacheEntryRemovedException
- Parameters:
nodeId- Node ID to clear.- Throws:
GridCacheEntryRemovedException- If removed.
-
clear
public boolean clear(GridCacheVersion ver, boolean readers) throws IgniteCheckedException
Marks entry as obsolete and, if possible or required, removes it from swap storage.- Specified by:
clearin interfaceGridCacheEntryEx- Parameters:
ver- Obsolete version.readers- Flag to clear readers as well.- Returns:
Trueif entry was not being used, passed the filter and could be removed.- Throws:
IgniteCheckedException- If failed to remove from swap.
-
obsoleteVersion
public GridCacheVersion obsoleteVersion()
- Specified by:
obsoleteVersionin interfaceGridCacheEntryEx- Returns:
- Not-null version if entry is obsolete.
-
markObsolete
public boolean markObsolete(GridCacheVersion ver)
Sets obsolete flag if possible.- Specified by:
markObsoletein interfaceGridCacheEntryEx- Parameters:
ver- Version to set as obsolete.- Returns:
Trueif entry is obsolete,falseif entry is still used by other threads or nodes.
-
markObsoleteIfEmpty
public boolean markObsoleteIfEmpty(@Nullable @Nullable GridCacheVersion obsoleteVer) throws IgniteCheckedExceptionSets obsolete flag if entry value isnullor entry is expired and no locks are held.- Specified by:
markObsoleteIfEmptyin interfaceGridCacheEntryEx- Parameters:
obsoleteVer- Version to set as obsolete.- Returns:
Trueif entry was marked obsolete.- Throws:
IgniteCheckedException- If failed.
-
markObsoleteVersion
public boolean markObsoleteVersion(GridCacheVersion ver)
Sets obsolete flag if entry version equals tover.- Specified by:
markObsoleteVersionin interfaceGridCacheEntryEx- Parameters:
ver- Version to compare with.- Returns:
Trueif marked obsolete.
-
evictionDisabled
protected boolean evictionDisabled()
- Returns:
Trueif this entry should not be evicted from cache.
-
markObsolete0
protected final boolean markObsolete0(GridCacheVersion ver, boolean clear, GridCacheObsoleteEntryExtras extras)
Note that
onMarkedObsolete()should always be called after this method returnstrue.- Parameters:
ver- Version.clear-Trueto clear.extras- Predefined extras.- Returns:
Trueif entry is obsolete,falseif entry is still used by other threads or nodes.
-
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
-
obsolete
public final boolean obsolete()
- Specified by:
obsoletein interfaceGridCacheEntryEx- Returns:
Trueif entry is obsolete.
-
obsolete
public final boolean obsolete(GridCacheVersion exclude)
- Specified by:
obsoletein interfaceGridCacheEntryEx- Parameters:
exclude- Obsolete version to ignore.- Returns:
Trueif obsolete version is notnulland is not the passed in version.
-
invalidate
public boolean invalidate(GridCacheVersion newVer) throws IgniteCheckedException
Invalidates this entry.- Specified by:
invalidatein interfaceGridCacheEntryEx- Parameters:
newVer- New version to set.- Returns:
trueif entry is obsolete.- Throws:
IgniteCheckedException- If swap could not be released.
-
onInvalidate
protected void onInvalidate()
Called when entry invalidated.
-
update
protected final void update(@Nullable @Nullable CacheObject val, long expireTime, long ttl, GridCacheVersion ver, boolean addTracked)- Parameters:
val- New value.expireTime- Expiration time.ttl- Time to live.ver- Update version.
-
checkObsolete
protected void checkObsolete() throws GridCacheEntryRemovedException- Throws:
GridCacheEntryRemovedException- If entry is obsolete.
-
key
public KeyCacheObject key()
- Specified by:
keyin interfaceGridCacheEntryEx- Returns:
- Key.
-
txKey
public IgniteTxKey txKey()
- Specified by:
txKeyin interfaceGridCacheEntryEx- Returns:
- Transaction key.
-
version
public GridCacheVersion version() throws GridCacheEntryRemovedException
- Specified by:
versionin interfaceGridCacheEntryEx- Returns:
- Version.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
checkSerializableReadVersion
public boolean checkSerializableReadVersion(GridCacheVersion serReadVer) throws GridCacheEntryRemovedException
Checks if there was read/write conflict in serializable transaction.- Specified by:
checkSerializableReadVersionin interfaceGridCacheEntryEx- Parameters:
serReadVer- Version read in serializable transaction.- Returns:
Trueif version check passed.- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
peek
@Nullable public @Nullable CacheObject peek(boolean heap, boolean offheap, AffinityTopologyVersion topVer, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc) throws GridCacheEntryRemovedException, IgniteCheckedException
Peeks into entry without loading value or updating statistics.- Specified by:
peekin interfaceGridCacheEntryEx- Parameters:
heap- Read from heap flag.offheap- Read from offheap flag.topVer- Topology version.expiryPlc- Expiry policy if TTL should be updated.- Returns:
- Value.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.IgniteCheckedException- If failed.
-
peek
@Nullable public @Nullable CacheObject peek() throws GridCacheEntryRemovedException, IgniteCheckedException
Peeks into entry without loading value or updating statistics.- Specified by:
peekin interfaceGridCacheEntryEx- Returns:
- Value.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.IgniteCheckedException- If failed.
-
rawGet
public CacheObject rawGet()
- Specified by:
rawGetin interfaceGridCacheEntryEx- Returns:
- Value.
-
hasValue
public final boolean hasValue()
- Specified by:
hasValuein interfaceGridCacheEntryEx- Returns:
Trueif has value or value bytes.
-
hasValueUnlocked
protected final boolean hasValueUnlocked()
- Returns:
Trueif this entry has value.
-
rawPut
public CacheObject rawPut(CacheObject val, long ttl)
- Specified by:
rawPutin interfaceGridCacheEntryEx- Parameters:
val- New value.ttl- Time to live.- Returns:
- Old value.
-
initialValue
public boolean initialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary, CacheDataRow row) throws IgniteCheckedException, GridCacheEntryRemovedException
Sets new value if current version is 0- Specified by:
initialValuein interfaceGridCacheEntryEx- Parameters:
val- New value.ver- Version to use.ttl- Time to live.expireTime- Expiration time.preload- Flag indicating whether entry is being preloaded.topVer- Topology version.drType- DR type.fromStore-Trueif value was loaded from store.primary-Trueif current node is primary for partition.row- Pre-created data row, associated with this cache entry.- Returns:
Trueif initial value was set.- Throws:
IgniteCheckedException- In case of error.GridCacheEntryRemovedException- If entry was removed.
-
onUpdateFinished
protected void onUpdateFinished(long cntr)
- Parameters:
cntr- Updated partition counter.
-
nextPartitionCounter
protected long nextPartitionCounter(AffinityTopologyVersion topVer, boolean primary, boolean initial, @Nullable @Nullable Long primaryCntr)
- Parameters:
topVer- Topology version for current operation.primary- Primary node update flag.initial-Trueif initial value.primaryCntr- Counter assigned on primary node.- Returns:
- Update counter.
-
nextPartitionCounter
protected long nextPartitionCounter(IgniteInternalTx tx, @Nullable @Nullable Long updateCntr)
- Parameters:
tx- Tx.updateCntr- Update counter.
-
versionedEntry
public GridCacheVersionedEntryEx versionedEntry(boolean keepBinary) throws IgniteCheckedException, GridCacheEntryRemovedException
Create versioned entry for this cache entry.- Specified by:
versionedEntryin interfaceGridCacheEntryEx- Parameters:
keepBinary- Keep binary flag.- Returns:
- Versioned entry.
- Throws:
IgniteCheckedException- In case of error.GridCacheEntryRemovedException- If entry was removed.
-
clearReserveForLoad
public void clearReserveForLoad(GridCacheVersion ver)
- Specified by:
clearReserveForLoadin interfaceGridCacheEntryEx- Parameters:
ver- Expected entry version.
-
versionedValue
public EntryGetResult versionedValue(CacheObject val, GridCacheVersion curVer, GridCacheVersion newVer, @Nullable @Nullable IgniteCacheExpiryPolicy loadExpiryPlc, @Nullable @Nullable ReaderArguments readerArgs) throws IgniteCheckedException, GridCacheEntryRemovedException
Sets new value if passed in version matches the current version (used for read-through only).- Specified by:
versionedValuein interfaceGridCacheEntryEx- Parameters:
val- New value.curVer- Version to match ornullif match is not required.newVer- Version to set.loadExpiryPlc- Expiry policy if entry is loaded from store.readerArgs- Reader will be added if not null.- Returns:
- Current version and value.
- Throws:
IgniteCheckedException- If index could not be updated.GridCacheEntryRemovedException- If entry was removed.
-
hasLockCandidate
public boolean hasLockCandidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
Checks if the candidate is either owner or pending.- Specified by:
hasLockCandidatein interfaceGridCacheEntryEx- Parameters:
ver- Candidate version to check.- Returns:
Trueif the candidate is either owner or pending.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
hasLockCandidate
public boolean hasLockCandidate(long threadId) throws GridCacheEntryRemovedExceptionChecks if the candidate is either owner or pending.- Specified by:
hasLockCandidatein interfaceGridCacheEntryEx- Parameters:
threadId- ThreadId.- Returns:
Trueif the candidate is either owner or pending.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByAny
public boolean lockedByAny(GridCacheVersion... exclude) throws GridCacheEntryRemovedException
- Specified by:
lockedByAnyin interfaceGridCacheEntryEx- Parameters:
exclude- Exclude versions.- Returns:
Trueif lock is owned by any thread or node.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThread
public boolean lockedByThread() throws GridCacheEntryRemovedException- Specified by:
lockedByThreadin interfaceGridCacheEntryEx- Returns:
Trueif lock is owned by current thread.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedLocally
public boolean lockedLocally(GridCacheVersion lockVer) throws GridCacheEntryRemovedException
- Specified by:
lockedLocallyin interfaceGridCacheEntryEx- Parameters:
lockVer- Lock ID to check.- Returns:
Trueif lock is owned by candidate.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThread
public boolean lockedByThread(long threadId, GridCacheVersion exclude) throws GridCacheEntryRemovedException- Specified by:
lockedByThreadin interfaceGridCacheEntryEx- Parameters:
threadId- Thread ID to check.exclude- Version to exclude from check.- Returns:
Trueif lock is owned by given thread.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedLocallyByIdOrThread
public boolean lockedLocallyByIdOrThread(GridCacheVersion lockVer, long threadId) throws GridCacheEntryRemovedException
- Specified by:
lockedLocallyByIdOrThreadin interfaceGridCacheEntryEx- Parameters:
lockVer- Lock ID.threadId- Thread ID.- Returns:
Trueif locked either locally or by thread.- Throws:
GridCacheEntryRemovedException- If removed.
-
lockedByThread
public boolean lockedByThread(long threadId) throws GridCacheEntryRemovedException- Specified by:
lockedByThreadin interfaceGridCacheEntryEx- Parameters:
threadId- Thread ID to check.- Returns:
Trueif lock is owned by given thread.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedBy
public boolean lockedBy(GridCacheVersion ver) throws GridCacheEntryRemovedException
- Specified by:
lockedByin interfaceGridCacheEntryEx- Parameters:
ver- Version to check for ownership.- Returns:
Trueif owner has the specified version.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThreadUnsafe
public boolean lockedByThreadUnsafe(long threadId)
Will not fail for removed entries.- Specified by:
lockedByThreadUnsafein interfaceGridCacheEntryEx- Parameters:
threadId- Thread ID to check.- Returns:
Trueif lock is owned by given thread.
-
lockedByUnsafe
public boolean lockedByUnsafe(GridCacheVersion ver)
- Specified by:
lockedByUnsafein interfaceGridCacheEntryEx- Parameters:
ver- Version to check for ownership.- Returns:
Trueif owner has the specified version.
-
lockedLocallyUnsafe
public boolean lockedLocallyUnsafe(GridCacheVersion lockVer)
- Specified by:
lockedLocallyUnsafein interfaceGridCacheEntryEx- Parameters:
lockVer- Lock ID to check.- Returns:
Trueif lock is owned by candidate.
-
hasLockCandidateUnsafe
public boolean hasLockCandidateUnsafe(GridCacheVersion ver)
- Specified by:
hasLockCandidateUnsafein interfaceGridCacheEntryEx- Parameters:
ver- Lock version to check.- Returns:
Trueif has candidate with given lock ID.
-
localCandidates
public Collection<GridCacheMvccCandidate> localCandidates(GridCacheVersion... exclude) throws GridCacheEntryRemovedException
Gets all local candidates.- Specified by:
localCandidatesin interfaceGridCacheEntryEx- Parameters:
exclude- Versions to exclude from check.- Returns:
- All local candidates.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
remoteMvccSnapshot
public Collection<GridCacheMvccCandidate> remoteMvccSnapshot(GridCacheVersion... exclude)
Gets all remote versions.- Specified by:
remoteMvccSnapshotin interfaceGridCacheEntryEx- Parameters:
exclude- Exclude version.- Returns:
- All remote versions minus the excluded ones, if any.
-
candidate
@Nullable public @Nullable GridCacheMvccCandidate candidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
Gets lock candidate for given lock ID.- Specified by:
candidatein interfaceGridCacheEntryEx- Parameters:
ver- Lock version.- Returns:
- Lock candidate for given ID.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
localCandidate
public GridCacheMvccCandidate localCandidate(long threadId) throws GridCacheEntryRemovedException
- Specified by:
localCandidatein interfaceGridCacheEntryEx- Parameters:
threadId- Thread ID.- Returns:
- Local candidate.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
candidate
public GridCacheMvccCandidate candidate(UUID nodeId, long threadId) throws GridCacheEntryRemovedException
- Specified by:
candidatein interfaceGridCacheEntryEx- Parameters:
nodeId- Node ID.threadId- Thread ID.- Returns:
- Candidate.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
localOwner
public GridCacheMvccCandidate localOwner() throws GridCacheEntryRemovedException
- Specified by:
localOwnerin interfaceGridCacheEntryEx- Returns:
- Local owner.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
rawExpireTime
public long rawExpireTime()
- Specified by:
rawExpireTimein interfaceGridCacheEntryEx- Returns:
- Expire time, without accounting for transactions or removals.
-
expireTimeUnlocked
public long expireTimeUnlocked()
- Specified by:
expireTimeUnlockedin interfaceGridCacheEntryEx- Returns:
- Expiration time. Does not check for entry obsolete flag.
-
onTtlExpired
public boolean onTtlExpired(GridCacheVersion obsoleteVer) throws GridCacheEntryRemovedException
Callback from ttl processor to cache entry indicating that entry is expired.- Specified by:
onTtlExpiredin interfaceGridCacheEntryEx- Parameters:
obsoleteVer- Version to set obsolete if entry is expired.- Returns:
Trueif this entry was expired as a result of this call.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
rawTtl
public long rawTtl()
- Specified by:
rawTtlin interfaceGridCacheEntryEx- Returns:
- Time to live, without accounting for transactions or removals.
-
expireTime
public long expireTime() throws GridCacheEntryRemovedException- Specified by:
expireTimein interfaceGridCacheEntryEx- Returns:
- Expiration time.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
ttl
public long ttl() throws GridCacheEntryRemovedException- Specified by:
ttlin interfaceGridCacheEntryEx- Returns:
- Time to live.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
updateTtl
public void updateTtl(GridCacheVersion ver, IgniteCacheExpiryPolicy expiryPlc) throws GridCacheEntryRemovedException
- Specified by:
updateTtlin interfaceGridCacheEntryEx- Parameters:
ver- Version.expiryPlc- Expiry policy.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
updateTtl
public void updateTtl(@Nullable @Nullable GridCacheVersion ver, long ttl) throws GridCacheEntryRemovedException- Specified by:
updateTtlin interfaceGridCacheEntryEx- Parameters:
ver- Version.ttl- Time to live.- Throws:
GridCacheEntryRemovedException
-
valueBytes
public CacheObject valueBytes() throws GridCacheEntryRemovedException
- Specified by:
valueBytesin interfaceGridCacheEntryEx- Returns:
- Value bytes.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
valueBytes
@Nullable public @Nullable CacheObject valueBytes(@Nullable @Nullable GridCacheVersion ver) throws IgniteCheckedException, GridCacheEntryRemovedException
Gets cached serialized value bytes.- Specified by:
valueBytesin interfaceGridCacheEntryEx- Parameters:
ver- Version for which to get value bytes.- Returns:
- Serialized value bytes.
- Throws:
IgniteCheckedException- If serialization failed.GridCacheEntryRemovedException- If entry was removed.
-
storeValue
protected boolean storeValue(@Nullable @Nullable CacheObject val, long expireTime, GridCacheVersion ver) throws IgniteCheckedExceptionStores value in offheap.- Parameters:
val- Value.expireTime- Expire time.ver- New entry version.- Throws:
IgniteCheckedException- If update failed.
-
storeValue
protected boolean storeValue(@Nullable @Nullable CacheObject val, long expireTime, GridCacheVersion ver, @Nullable @Nullable IgnitePredicate<CacheDataRow> predicate, @Nullable @Nullable CacheDataRow row) throws IgniteCheckedExceptionStores value in off-heap.- Parameters:
val- Value.expireTime- Expire time.ver- New entry version.predicate- Optional predicate.row- Pre-created data row, associated with this cache entry.- Returns:
Trueif storage was modified.- Throws:
IgniteCheckedException- If update failed.
-
logUpdate
protected void logUpdate(GridCacheOperation op, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr, boolean primary) throws IgniteCheckedException
- Parameters:
op- Update operation.val- Write value.writeVer- Write version.expireTime- Expire time.updCntr- Update counter.primary-Trueif node is primary for entry in the moment of logging.- Throws:
IgniteCheckedException
-
logTxUpdate
protected WALPointer logTxUpdate(IgniteInternalTx tx, CacheObject val, GridCacheVersion writeVer, long expireTime, long updCntr) throws IgniteCheckedException
- Parameters:
tx- Transaction.val- Value.writeVer- New entry version.expireTime- Expire time (or 0 if not applicable).updCntr- Update counter.- Throws:
IgniteCheckedException- In case of log failure.
-
removeValue
protected void removeValue() throws IgniteCheckedExceptionRemoves value from offheap.- Throws:
IgniteCheckedException- If failed.
-
wrap
public <K,V> javax.cache.Cache.Entry<K,V> wrap()
Wraps this map entry into cache entry.- Specified by:
wrapin interfaceGridCacheEntryEx- Returns:
- Wrapped entry.
-
wrapLazyValue
public <K,V> javax.cache.Cache.Entry<K,V> wrapLazyValue(boolean keepBinary)
Wraps entry to an entry with lazy value get.- Specified by:
wrapLazyValuein interfaceGridCacheEntryEx- Parameters:
keepBinary- Keep binary flag.- Returns:
- Entry.
-
peekVisibleValue
@Nullable public @Nullable CacheObject peekVisibleValue()
Peeks value provided to public API entries and to entry filters.- Specified by:
peekVisibleValuein interfaceGridCacheEntryEx- Returns:
- Value.
-
updateIndex
public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException, GridCacheEntryRemovedException
Update index from within entry lock, passing key, value, and expiration time to provided closure.- Specified by:
updateIndexin interfaceGridCacheEntryEx- Parameters:
clo- Closure to apply to key, value, and expiration time.- Throws:
IgniteCheckedException- If failed.GridCacheEntryRemovedException- If entry was removed.
-
wrapEviction
public <K,V> EvictableEntry<K,V> wrapEviction()
- Specified by:
wrapEvictionin interfaceGridCacheEntryEx- Returns:
- Entry which is safe to pass into eviction policy.
-
wrapVersioned
public <K,V> CacheEntryImplEx<K,V> wrapVersioned()
- Specified by:
wrapVersionedin interfaceGridCacheEntryEx- Returns:
- Entry which holds key and version (no value, since entry is intended to be used in sync evictions checks).
-
evictInternal
public boolean evictInternal(GridCacheVersion obsoleteVer, @Nullable @Nullable CacheEntryPredicate[] filter, boolean evictOffheap) throws IgniteCheckedException
- Specified by:
evictInternalin interfaceGridCacheEntryEx- Parameters:
obsoleteVer- Version for eviction.filter- Optional filter.evictOffheap- Evict offheap value flag.- Returns:
Trueif entry could be evicted.- Throws:
IgniteCheckedException- In case of error.
-
visitable
public final boolean visitable(CacheEntryPredicate[] filter)
- Parameters:
filter- Entry filter.- Returns:
Trueif entry is visitable.
-
deleted
public final boolean deleted()
Note: this method works only for cache configured in ATOMIC mode or for cache that is data center replication target.- Specified by:
deletedin interfaceGridCacheEntryEx- Returns:
Trueif entry has been already deleted.
-
obsoleteOrDeleted
public final boolean obsoleteOrDeleted()
- Specified by:
obsoleteOrDeletedin interfaceGridCacheEntryEx- Returns:
Trueif entry is obsolete or deleted.- See Also:
GridCacheEntryEx.deleted()
-
deletedUnlocked
protected final boolean deletedUnlocked()
- Returns:
Trueif deleted.
-
deletedUnlocked
protected final void deletedUnlocked(boolean deleted)
- Parameters:
deleted-Trueif deleted.
-
incrementMapPublicSize
protected void incrementMapPublicSize()
Increments public size of map.
-
decrementMapPublicSize
protected void decrementMapPublicSize()
Decrements public size of map.
-
mvccExtras
@Nullable protected final @Nullable GridCacheMvcc mvccExtras()
- Returns:
- MVCC.
-
mvccAllLocal
@Nullable public final @Nullable List<GridCacheMvccCandidate> mvccAllLocal()
- Returns:
- All MVCC local and non near candidates.
-
mvccExtras
protected final void mvccExtras(@Nullable @Nullable GridCacheMvcc mvcc)- Parameters:
mvcc- MVCC.
-
obsoleteVersionExtras
@Nullable protected final @Nullable GridCacheVersion obsoleteVersionExtras()
- Returns:
- Obsolete version.
-
checkOwnerChanged
protected final void checkOwnerChanged(@Nullable @Nullable CacheLockCandidates prevOwners, @Nullable @Nullable CacheLockCandidates owners, CacheObject val)- Parameters:
prevOwners- Previous owners.owners- Current owners.val- Entry value.
-
checkOwnerChanged
protected final void checkOwnerChanged(@Nullable @Nullable CacheLockCandidates prevOwners, @Nullable @Nullable CacheLockCandidates owners, CacheObject val, boolean inThreadChain)- Parameters:
prevOwners- Previous owners.owners- Current owners.val- Entry value.inThreadChain-Trueif called during thread chain checking.
-
checkThreadChain
protected abstract void checkThreadChain(GridCacheMvccCandidate owner)
- Parameters:
owner- Starting candidate in the chain.
-
ttlExtras
public long ttlExtras()
- Returns:
- TTL.
-
expireTimeExtras
public long expireTimeExtras()
- Returns:
- Expire time.
-
ttlAndExpireTimeExtras
protected void ttlAndExpireTimeExtras(long ttl, long expireTime)- Parameters:
ttl- TTL.expireTime- Expire time.
-
txUnlock
public void txUnlock(IgniteInternalTx tx) throws GridCacheEntryRemovedException
Unlocks acquired lock.- Specified by:
txUnlockin interfaceGridCacheEntryEx- Parameters:
tx- Cache transaction.- Throws:
GridCacheEntryRemovedException- If this entry has been removed from cache.
-
onUnlock
public void onUnlock()
CallsGridDhtLocalPartition.onUnlock()for this entry's partition.- Specified by:
onUnlockin interfaceGridCacheEntryEx
-
lockEntry
public void lockEntry()
Locks entry to protect from concurrent access. Intended to be used instead of inherent java synchronization. This allows to separate locking from unlocking in time and/or code units.- Specified by:
lockEntryin interfaceGridCacheEntryEx
-
tryLockEntry
public boolean tryLockEntry(long timeout)
Locks entry to protect from concurrent access. Intended to be used instead of inherent java synchronization. This allows to separate locking from unlocking in time and/or code units.- Specified by:
tryLockEntryin interfaceGridCacheEntryEx- Parameters:
timeout- period of waiting in millis;- Returns:
trueif the lock was free and was acquired by the current thread, or the lock was already held by the current thread; andfalseif the waiting time elapsed before the lock could be acquired
-
unlockEntry
public void unlockEntry()
Unlocks entry previously locked byGridCacheEntryEx.lockEntry().- Specified by:
unlockEntryin interfaceGridCacheEntryEx
-
lockedByCurrentThread
public boolean lockedByCurrentThread()
Tests whether the entry is locked currently.- Specified by:
lockedByCurrentThreadin interfaceGridCacheEntryEx- Returns:
Trueif the entry is locked.
-
touch
public void touch()
Touch this entry in its context's eviction manager.- Specified by:
touchin interfaceGridCacheEntryEx
-
toStringWithTryLock
protected String toStringWithTryLock(Supplier<String> dfltToStr)
Does thread safetoString()forGridCacheMapEntryclasses.- Parameters:
dfltToStr-toString()supplier.- Returns:
- Result of dfltToStr call If lock acquired or a short representation of
GridCacheMapEntry.
-
updatePlatformCache
protected void updatePlatformCache(@Nullable @Nullable CacheObject val, @Nullable @Nullable AffinityTopologyVersion ver)Invokes platform cache update callback, if applicable.- Parameters:
val- Updated value, null on remove.ver- Topology version, null on remove.
-
-