Interface GridCacheEntryEx
-
- All Known Implementing Classes:
GridCacheMapEntry,GridDhtCacheEntry,GridDhtDetachedCacheEntry,GridDistributedCacheEntry,GridNearCacheEntry
public interface GridCacheEntryExInternal API for cache entry ('Ex'stands for extended).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <V> VaddMeta(int key, V val)Adds a new metadata.@Nullable GridCacheMvccCandidatecandidate(UUID nodeId, long threadId)@Nullable GridCacheMvccCandidatecandidate(GridCacheVersion ver)Gets lock candidate for given lock ID.booleancheckSerializableReadVersion(GridCacheVersion serReadVer)Checks if there was read/write conflict in serializable transaction.booleanclear(GridCacheVersion ver, boolean readers)Marks entry as obsolete and, if possible or required, removes it from swap storage.voidclearReserveForLoad(GridCacheVersion ver)<K,V>
GridCacheContext<K,V>context()booleandeleted()Note: this method works only for cache configured in ATOMIC mode or for cache that is data center replication target.booleandetached()booleanevictInternal(GridCacheVersion obsoleteVer, @Nullable CacheEntryPredicate[] filter, boolean evictOffheap)longexpireTime()longexpireTimeUnlocked()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)booleanhasMeta(int key)Tests whether or not given metadata is set.booleanhasValue()@Nullable GridCacheEntryInfoinfo()default booleaninitialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary)Sets new value if current version is 0booleaninitialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary, @Nullable 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 expiryPlc, 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, @Nullable 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 ver, UUID evtNodeId, UUID affNodeId, GridCacheOperation op, @Nullable Object val, @Nullable Object[] invokeArgs, boolean writeThrough, boolean readThrough, boolean retval, boolean keepBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, boolean primary, boolean checkVer, boolean readRepairRecovery, AffinityTopologyVersion topVer, @Nullable CacheEntryPredicate[] filter, GridDrType drType, long conflictTtl, long conflictExpireTime, @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()KeyCacheObjectkey()@Nullable GridCacheMvccCandidatelocalCandidate(long threadId)Collection<GridCacheMvccCandidate>localCandidates(@Nullable GridCacheVersion... exclude)Gets all local candidates.@Nullable GridCacheMvccCandidatelocalOwner()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.booleanmarkObsolete(GridCacheVersion ver)Sets obsolete flag if possible.booleanmarkObsoleteIfEmpty(@Nullable GridCacheVersion ver)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()<V> Vmeta(int key)Gets metadata by key.booleanobsolete()booleanobsolete(GridCacheVersion exclude)booleanobsoleteOrDeleted()GridCacheVersionobsoleteVersion()voidonMarkedObsolete()This method should be called each time entry is marked obsolete other than by callingmarkObsolete(GridCacheVersion).booleanonTtlExpired(GridCacheVersion obsoleteVer)Callback from ttl processor to cache entry indicating that entry is expired.voidonUnlock()CallsGridDhtLocalPartition.onUnlock()for this entry's partition.intpartition()booleanpartitionValid()@Nullable CacheObjectpeek()Peeks into entry without loading value or updating statistics.@Nullable CacheObjectpeek(boolean heap, boolean offheap, AffinityTopologyVersion topVer, @Nullable IgniteCacheExpiryPolicy plc)Peeks into entry without loading value or updating statistics.@Nullable CacheObjectpeekVisibleValue()Peeks value provided to public API entries and to entry filters.<V> VputMetaIfAbsent(int key, V val)Adds given metadata value only if it was absent.longrawExpireTime()CacheObjectrawGet()CacheObjectrawPut(CacheObject val, long ttl)longrawTtl()Collection<GridCacheMvccCandidate>remoteMvccSnapshot(GridCacheVersion... exclude)Gets all remote versions.booleanremoveLock(GridCacheVersion ver)<V> VremoveMeta(int key)Removes metadata by key.<V> booleanremoveMeta(int key, V val)Removes metadata only if its current value is equal tovalpassed in.<V> booleanreplaceMeta(int key, V curVal, V newVal)Replaces given metadata with newnewValvalue only if its current value is equal tocurVal.booleantmLock(IgniteInternalTx tx, long timeout, @Nullable GridCacheVersion serOrder, @Nullable GridCacheVersion serReadVer, boolean read)This locks is called by transaction manager during prepare step for optimistic transactions.voidtouch()Touch this entry in its context's eviction manager.booleantryLockEntry(long timeout)Locks entry to protect from concurrent access.longttl()IgniteTxKeytxKey()voidtxUnlock(IgniteInternalTx tx)Unlocks acquired lock.voidunlockEntry()Unlocks entry previously locked bylockEntry().@Nullable CacheObjectunswap()@Nullable CacheObjectunswap(boolean needVal)Unswap ignoring flags.@Nullable CacheObjectunswap(CacheDataRow row)voidupdateIndex(SchemaIndexCacheVisitorClosure clo)Update index from within entry lock, passing key, value, and expiration time to provided closure.voidupdateTtl(@Nullable GridCacheVersion ver, long ttl)voidupdateTtl(GridCacheVersion ver, IgniteCacheExpiryPolicy expiryPlc)booleanvalid(AffinityTopologyVersion topVer)CacheObjectvalueBytes()@Nullable CacheObjectvalueBytes(@Nullable GridCacheVersion ver)Gets cached serialized value bytes.GridCacheVersionversion()<K,V>
GridCacheVersionedEntryEx<K,V>versionedEntry(boolean keepBinary)Create versioned entry for this cache entry.EntryGetResultversionedValue(CacheObject val, @Nullable GridCacheVersion curVer, @Nullable GridCacheVersion newVer, @Nullable IgniteCacheExpiryPolicy loadExpiryPlc, @Nullable ReaderArguments readerArgs)Sets new value if passed in version matches the current version (used for read-through only).<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()
-
-
-
Method Detail
-
memorySize
int memorySize() throws IgniteCheckedException- Returns:
- Memory size.
- Throws:
IgniteCheckedException- If failed.
-
isInternal
boolean isInternal()
- Returns:
Trueif entry is internal cache entry.
-
isDht
boolean isDht()
- Returns:
Trueif DHT.
-
isNear
boolean isNear()
- Returns:
Trueif near.
-
isReplicated
boolean isReplicated()
- Returns:
Trueif replicated.
-
isLocal
boolean isLocal()
- Returns:
Trueif local.
-
detached
boolean detached()
- Returns:
Falseif entry belongs to cache map,trueif this entry was created in colocated cache and node is not primary for this key.
-
deleted
boolean deleted()
Note: this method works only for cache configured in ATOMIC mode or for cache that is data center replication target.- Returns:
Trueif entry has been already deleted.
-
context
<K,V> GridCacheContext<K,V> context()
- Returns:
- Context.
-
partition
int partition()
- Returns:
- Partition ID.
-
key
KeyCacheObject key()
- Returns:
- Key.
-
txKey
IgniteTxKey txKey()
- Returns:
- Transaction key.
-
rawGet
CacheObject rawGet()
- Returns:
- Value.
-
hasValue
boolean hasValue()
- Returns:
Trueif has value or value bytes.
-
rawPut
CacheObject rawPut(CacheObject val, long ttl)
- Parameters:
val- New value.ttl- Time to live.- Returns:
- Old value.
-
wrap
<K,V> javax.cache.Cache.Entry<K,V> wrap()
Wraps this map entry into cache entry.- Returns:
- Wrapped entry.
-
wrapLazyValue
<K,V> javax.cache.Cache.Entry<K,V> wrapLazyValue(boolean keepBinary)
Wraps entry to an entry with lazy value get.- Parameters:
keepBinary- Keep binary flag.- Returns:
- Entry.
-
peekVisibleValue
@Nullable @Nullable CacheObject peekVisibleValue()
Peeks value provided to public API entries and to entry filters.- Returns:
- Value.
-
wrapEviction
<K,V> EvictableEntry<K,V> wrapEviction()
- Returns:
- Entry which is safe to pass into eviction policy.
-
wrapVersioned
<K,V> CacheEntryImplEx<K,V> wrapVersioned()
- Returns:
- Entry which holds key and version (no value, since entry is intended to be used in sync evictions checks).
-
obsoleteVersion
GridCacheVersion obsoleteVersion()
- Returns:
- Not-null version if entry is obsolete.
-
obsolete
boolean obsolete()
- Returns:
Trueif entry is obsolete.
-
obsoleteOrDeleted
boolean obsoleteOrDeleted()
- Returns:
Trueif entry is obsolete or deleted.- See Also:
deleted()
-
obsolete
boolean obsolete(GridCacheVersion exclude)
- Parameters:
exclude- Obsolete version to ignore.- Returns:
Trueif obsolete version is notnulland is not the passed in version.
-
info
@Nullable @Nullable GridCacheEntryInfo info()
- Returns:
- Entry info.
-
invalidate
boolean invalidate(GridCacheVersion newVer) throws IgniteCheckedException
Invalidates this entry.- Parameters:
newVer- New version to set.- Returns:
trueif entry is obsolete.- Throws:
IgniteCheckedException- If swap could not be released.
-
evictInternal
boolean evictInternal(GridCacheVersion obsoleteVer, @Nullable @Nullable CacheEntryPredicate[] filter, boolean evictOffheap) throws IgniteCheckedException
- 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.
-
onMarkedObsolete
void onMarkedObsolete()
This method should be called each time entry is marked obsolete other than by callingmarkObsolete(GridCacheVersion).
-
isNew
boolean isNew() throws GridCacheEntryRemovedExceptionChecks if entry is new assuming lock is held externally.- Returns:
Trueif entry is new.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
isNewLocked
boolean isNewLocked() throws GridCacheEntryRemovedExceptionChecks if entry is new while holding lock.- Returns:
Trueif entry is new.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
valid
boolean valid(AffinityTopologyVersion topVer)
- Parameters:
topVer- Topology version where validation should be performed. When negative the latest available topology should be used.- Returns:
- Checks if value is valid.
-
partitionValid
boolean partitionValid()
- Returns:
Trueif partition is in valid.
-
innerGet
CacheObject innerGet(@Nullable @Nullable GridCacheVersion ver, @Nullable @Nullable IgniteInternalTx tx, boolean readThrough, boolean updateMetrics, boolean evt, Object transformClo, String taskName, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary) throws IgniteCheckedException, GridCacheEntryRemovedException
- 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.expiryPlc- Expiry policy.keepBinary- Keep binary flag.- Returns:
- Cached value.
- Throws:
IgniteCheckedException- If loading value failed.GridCacheEntryRemovedException- If entry was removed.
-
innerGetVersioned
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
- 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.
-
innerGetAndReserveForLoad
EntryGetResult innerGetAndReserveForLoad(boolean updateMetrics, boolean evt, String taskName, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean keepBinary, @Nullable @Nullable ReaderArguments readerArgs) throws IgniteCheckedException, GridCacheEntryRemovedException
- 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.
-
clearReserveForLoad
void clearReserveForLoad(GridCacheVersion ver)
- Parameters:
ver- Expected entry version.
-
innerReload
@Nullable @Nullable CacheObject innerReload() throws IgniteCheckedException, GridCacheEntryRemovedException
Reloads entry from underlying storage.- Returns:
- Reloaded value.
- Throws:
IgniteCheckedException- If reload failed.GridCacheEntryRemovedException- If entry has been removed.
-
innerSet
GridCacheUpdateTxResult innerSet(@Nullable @Nullable IgniteInternalTx tx, UUID evtNodeId, UUID affNodeId, @Nullable @Nullable 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
- 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.
-
innerRemove
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
- 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
GridCacheUpdateAtomicResult innerUpdate(GridCacheVersion ver, UUID evtNodeId, UUID affNodeId, GridCacheOperation op, @Nullable @Nullable Object val, @Nullable @Nullable Object[] invokeArgs, boolean writeThrough, boolean readThrough, boolean retval, boolean keepBinary, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, boolean primary, boolean checkVer, boolean readRepairRecovery, AffinityTopologyVersion topVer, @Nullable @Nullable CacheEntryPredicate[] filter, GridDrType drType, long conflictTtl, long conflictExpireTime, @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
- Parameters:
ver- 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.val- 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).checkVer- 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.conflictTtl- Conflict TTL (if any).conflictExpireTime- 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.
-
clear
boolean clear(GridCacheVersion ver, boolean readers) throws IgniteCheckedException
Marks entry as obsolete and, if possible or required, removes it from swap storage.- 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.
-
tmLock
boolean tmLock(IgniteInternalTx tx, long timeout, @Nullable @Nullable GridCacheVersion serOrder, @Nullable @Nullable 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.
-
txUnlock
void txUnlock(IgniteInternalTx tx) throws GridCacheEntryRemovedException
Unlocks acquired lock.- Parameters:
tx- Cache transaction.- Throws:
GridCacheEntryRemovedException- If this entry has been removed from cache.
-
removeLock
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.
-
markObsolete
boolean markObsolete(GridCacheVersion ver)
Sets obsolete flag if possible.- Parameters:
ver- Version to set as obsolete.- Returns:
Trueif entry is obsolete,falseif entry is still used by other threads or nodes.
-
markObsoleteIfEmpty
boolean markObsoleteIfEmpty(@Nullable @Nullable GridCacheVersion ver) throws IgniteCheckedExceptionSets obsolete flag if entry value isnullor entry is expired and no locks are held.- Parameters:
ver- Version to set as obsolete.- Returns:
Trueif entry was marked obsolete.- Throws:
IgniteCheckedException- If failed.
-
markObsoleteVersion
boolean markObsoleteVersion(GridCacheVersion ver)
Sets obsolete flag if entry version equals tover.- Parameters:
ver- Version to compare with.- Returns:
Trueif marked obsolete.
-
version
GridCacheVersion version() throws GridCacheEntryRemovedException
- Returns:
- Version.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
checkSerializableReadVersion
boolean checkSerializableReadVersion(GridCacheVersion serReadVer) throws GridCacheEntryRemovedException
Checks if there was read/write conflict in serializable transaction.- Parameters:
serReadVer- Version read in serializable transaction.- Returns:
Trueif version check passed.- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
peek
@Nullable @Nullable CacheObject peek(boolean heap, boolean offheap, AffinityTopologyVersion topVer, @Nullable @Nullable IgniteCacheExpiryPolicy plc) throws GridCacheEntryRemovedException, IgniteCheckedException
Peeks into entry without loading value or updating statistics.- Parameters:
heap- Read from heap flag.offheap- Read from offheap flag.topVer- Topology version.plc- Expiry policy if TTL should be updated.- Returns:
- Value.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.IgniteCheckedException- If failed.
-
peek
@Nullable @Nullable CacheObject peek() throws GridCacheEntryRemovedException, IgniteCheckedException
Peeks into entry without loading value or updating statistics.- Returns:
- Value.
- Throws:
GridCacheEntryRemovedException- If entry has been removed.IgniteCheckedException- If failed.
-
initialValue
default boolean initialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary) throws IgniteCheckedException, GridCacheEntryRemovedException
Sets new value if current version is 0- 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.- Returns:
Trueif initial value was set.- Throws:
IgniteCheckedException- In case of error.GridCacheEntryRemovedException- If entry was removed.
-
initialValue
boolean initialValue(CacheObject val, GridCacheVersion ver, long ttl, long expireTime, boolean preload, AffinityTopologyVersion topVer, GridDrType drType, boolean fromStore, boolean primary, @Nullable @Nullable CacheDataRow row) throws IgniteCheckedException, GridCacheEntryRemovedException
Sets new value if current version is 0- 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.
-
versionedEntry
<K,V> GridCacheVersionedEntryEx<K,V> versionedEntry(boolean keepBinary) throws IgniteCheckedException, GridCacheEntryRemovedException
Create versioned entry for this cache entry.- Parameters:
keepBinary- Keep binary flag.- Returns:
- Versioned entry.
- Throws:
IgniteCheckedException- In case of error.GridCacheEntryRemovedException- If entry was removed.
-
versionedValue
EntryGetResult versionedValue(CacheObject val, @Nullable @Nullable GridCacheVersion curVer, @Nullable @Nullable 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).- 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
boolean hasLockCandidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
Checks if the candidate is either owner or pending.- Parameters:
ver- Candidate version to check.- Returns:
Trueif the candidate is either owner or pending.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
hasLockCandidate
boolean hasLockCandidate(long threadId) throws GridCacheEntryRemovedExceptionChecks if the candidate is either owner or pending.- Parameters:
threadId- ThreadId.- Returns:
Trueif the candidate is either owner or pending.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByAny
boolean lockedByAny(GridCacheVersion... exclude) throws GridCacheEntryRemovedException
- Parameters:
exclude- Exclude versions.- Returns:
Trueif lock is owned by any thread or node.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThread
boolean lockedByThread() throws GridCacheEntryRemovedException- Returns:
Trueif lock is owned by current thread.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedLocallyByIdOrThread
boolean lockedLocallyByIdOrThread(GridCacheVersion lockVer, long threadId) throws GridCacheEntryRemovedException
- Parameters:
lockVer- Lock ID.threadId- Thread ID.- Returns:
Trueif locked either locally or by thread.- Throws:
GridCacheEntryRemovedException- If removed.
-
lockedLocally
boolean lockedLocally(GridCacheVersion lockVer) throws GridCacheEntryRemovedException
- Parameters:
lockVer- Lock ID to check.- Returns:
Trueif lock is owned by candidate.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThread
boolean lockedByThread(long threadId, GridCacheVersion exclude) throws GridCacheEntryRemovedException- 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.
-
lockedByThread
boolean lockedByThread(long threadId) throws GridCacheEntryRemovedException- Parameters:
threadId- Thread ID to check.- Returns:
Trueif lock is owned by given thread.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedBy
boolean lockedBy(GridCacheVersion ver) throws GridCacheEntryRemovedException
- Parameters:
ver- Version to check for ownership.- Returns:
Trueif owner has the specified version.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
lockedByThreadUnsafe
boolean lockedByThreadUnsafe(long threadId)
Will not fail for removed entries.- Parameters:
threadId- Thread ID to check.- Returns:
Trueif lock is owned by given thread.
-
lockedByUnsafe
boolean lockedByUnsafe(GridCacheVersion ver)
- Parameters:
ver- Version to check for ownership.- Returns:
Trueif owner has the specified version.
-
lockedLocallyUnsafe
boolean lockedLocallyUnsafe(GridCacheVersion lockVer)
- Parameters:
lockVer- Lock ID to check.- Returns:
Trueif lock is owned by candidate.
-
hasLockCandidateUnsafe
boolean hasLockCandidateUnsafe(GridCacheVersion ver)
- Parameters:
ver- Lock version to check.- Returns:
Trueif has candidate with given lock ID.
-
localCandidate
@Nullable @Nullable GridCacheMvccCandidate localCandidate(long threadId) throws GridCacheEntryRemovedException
- Parameters:
threadId- Thread ID.- Returns:
- Local candidate.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
localCandidates
Collection<GridCacheMvccCandidate> localCandidates(@Nullable @Nullable GridCacheVersion... exclude) throws GridCacheEntryRemovedException
Gets all local candidates.- Parameters:
exclude- Versions to exclude from check.- Returns:
- All local candidates.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
remoteMvccSnapshot
Collection<GridCacheMvccCandidate> remoteMvccSnapshot(GridCacheVersion... exclude)
Gets all remote versions.- Parameters:
exclude- Exclude version.- Returns:
- All remote versions minus the excluded ones, if any.
-
candidate
@Nullable @Nullable GridCacheMvccCandidate candidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
Gets lock candidate for given lock ID.- Parameters:
ver- Lock version.- Returns:
- Lock candidate for given ID.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
candidate
@Nullable @Nullable GridCacheMvccCandidate candidate(UUID nodeId, long threadId) throws GridCacheEntryRemovedException
- Parameters:
nodeId- Node ID.threadId- Thread ID.- Returns:
- Candidate.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
localOwner
@Nullable @Nullable GridCacheMvccCandidate localOwner() throws GridCacheEntryRemovedException
- Returns:
- Local owner.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
valueBytes
CacheObject valueBytes() throws GridCacheEntryRemovedException
- Returns:
- Value bytes.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
valueBytes
@Nullable @Nullable CacheObject valueBytes(@Nullable @Nullable GridCacheVersion ver) throws IgniteCheckedException, GridCacheEntryRemovedException
Gets cached serialized value bytes.- Parameters:
ver- Version for which to get value bytes.- Returns:
- Serialized value bytes.
- Throws:
IgniteCheckedException- If serialization failed.GridCacheEntryRemovedException- If entry was removed.
-
updateIndex
void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException, GridCacheEntryRemovedException
Update index from within entry lock, passing key, value, and expiration time to provided closure.- Parameters:
clo- Closure to apply to key, value, and expiration time.- Throws:
IgniteCheckedException- If failed.GridCacheEntryRemovedException- If entry was removed.
-
rawExpireTime
long rawExpireTime()
- Returns:
- Expire time, without accounting for transactions or removals.
-
expireTime
long expireTime() throws GridCacheEntryRemovedException- Returns:
- Expiration time.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
expireTimeUnlocked
long expireTimeUnlocked()
- Returns:
- Expiration time. Does not check for entry obsolete flag.
-
onTtlExpired
boolean onTtlExpired(GridCacheVersion obsoleteVer) throws GridCacheEntryRemovedException
Callback from ttl processor to cache entry indicating that entry is expired.- 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
long rawTtl()
- Returns:
- Time to live, without accounting for transactions or removals.
-
ttl
long ttl() throws GridCacheEntryRemovedException
- Returns:
- Time to live.
- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
updateTtl
void updateTtl(GridCacheVersion ver, IgniteCacheExpiryPolicy expiryPlc) throws GridCacheEntryRemovedException
- Parameters:
ver- Version.expiryPlc- Expiry policy.- Throws:
GridCacheEntryRemovedException- If entry was removed.
-
updateTtl
void updateTtl(@Nullable @Nullable GridCacheVersion ver, long ttl) throws GridCacheEntryRemovedException- Parameters:
ver- Version.ttl- Time to live.- Throws:
GridCacheEntryRemovedException
-
unswap
@Nullable @Nullable CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException
- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed to read from swap storage.GridCacheEntryRemovedException- If entry was removed.
-
unswap
@Nullable @Nullable CacheObject unswap(CacheDataRow row) throws IgniteCheckedException, GridCacheEntryRemovedException
- Parameters:
row- Already extracted value.- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed to read from swap storage.GridCacheEntryRemovedException- If entry was removed.
-
unswap
@Nullable @Nullable CacheObject unswap(boolean needVal) throws IgniteCheckedException, GridCacheEntryRemovedException
Unswap ignoring flags.- Parameters:
needVal- Iffalsethen do not need to deserialize value during unswap.- Returns:
- Value.
- Throws:
IgniteCheckedException- If failed.GridCacheEntryRemovedException- If entry was removed.
-
hasMeta
boolean hasMeta(int key)
Tests whether or not given metadata is set.- Parameters:
key- Key of the metadata to test.- Returns:
- Whether or not given metadata is set.
-
meta
@Nullable <V> V meta(int key)
Gets metadata by key.- Type Parameters:
V- Type of the value.- Parameters:
key- Metadata key.- Returns:
- Metadata value or
null.
-
addMeta
@Nullable <V> V addMeta(int key, V val)Adds a new metadata.- Type Parameters:
V- Type of the value.- Parameters:
key- Metadata key.val- Metadata value.- Returns:
- Metadata previously associated with given name, or
nullif there was none.
-
putMetaIfAbsent
@Nullable <V> V putMetaIfAbsent(int key, V val)Adds given metadata value only if it was absent.- Type Parameters:
V- Type of the value.- Parameters:
key- Metadata key.val- Value to add if it's not attached already.- Returns:
nullif new value was put, or current value if put didn't happen.
-
replaceMeta
<V> boolean replaceMeta(int key, V curVal, V newVal)Replaces given metadata with newnewValvalue only if its current value is equal tocurVal. Otherwise, it is no-op.- Parameters:
key- Key of the metadata.curVal- Current value to check.newVal- New value.- Returns:
trueif replacement occurred,falseotherwise.
-
removeMeta
@Nullable <V> V removeMeta(int key)
Removes metadata by key.- Type Parameters:
V- Type of the value.- Parameters:
key- Key of the metadata to remove.- Returns:
- Value of removed metadata or
null.
-
removeMeta
<V> boolean removeMeta(int key, V val)Removes metadata only if its current value is equal tovalpassed in.- Type Parameters:
V- Value type.- Parameters:
key- key of metadata attribute.val- Value to compare.- Returns:
Trueif value was removed,falseotherwise.
-
onUnlock
void onUnlock()
CallsGridDhtLocalPartition.onUnlock()for this entry's partition.
-
lockEntry
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.
-
unlockEntry
void unlockEntry()
Unlocks entry previously locked bylockEntry().
-
tryLockEntry
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.- 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
-
lockedByCurrentThread
boolean lockedByCurrentThread()
Tests whether the entry is locked currently.- Returns:
Trueif the entry is locked.
-
touch
void touch()
Touch this entry in its context's eviction manager.
-
-