public abstract class GridCacheMapEntry<K,V> extends Object implements GridCacheEntryEx<K,V>
| Modifier and Type | Field and Description |
|---|---|
static Comparator<GridCacheVersion> |
ATOMIC_VER_COMPARATOR |
protected GridCacheContext<K,V> |
cctx
Cache registry.
|
protected byte |
flags
Flags:
Deleted flag - mask
IS_DELETED_MASK
Unswapped flag - mask IS_UNSWAPPED_MASK
|
protected K |
key
Key.
|
protected static IgniteLogger |
log
Logger.
|
protected static AtomicReference<IgniteLogger> |
logRef
Static logger to avoid re-creation.
|
protected long |
startVer
Start version.
|
protected V |
val
Value.
|
protected byte[] |
valBytes
Value bytes.
|
protected GridCacheVersion |
ver
Version.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GridCacheMapEntry(GridCacheContext<K,V> cctx,
K key,
int hash,
V val,
GridCacheMapEntry<K,V> next,
long ttl,
int hdrId) |
| Modifier and Type | Method and Description |
|---|---|
<V1> V1 |
addMeta(String name,
V1 val)
Adds a new metadata.
|
GridCacheMvccCandidate<K> |
candidate(GridCacheVersion ver)
Gets lock candidate for given lock ID.
|
GridCacheMvccCandidate<K> |
candidate(UUID nodeId,
long threadId) |
protected void |
checkObsolete() |
boolean |
clear(GridCacheVersion ver,
boolean readers,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Marks entry as obsolete and, if possible or required, removes it
from swap storage.
|
protected void |
clearIndex(V prevVal)
Clears index.
|
protected void |
clearReader(UUID nodeId) |
protected void |
clearReaders() |
boolean |
compact(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Optimizes the size of this entry.
|
GridCacheContext<K,V> |
context() |
boolean |
deleted()
Note: this method works only for cache configured in ATOMIC mode or for cache that is
data center replication target.
|
protected boolean |
deletedUnlocked() |
protected void |
deletedUnlocked(boolean deleted) |
boolean |
detached() |
boolean |
equals(Object o) |
GridCacheBatchSwapEntry<K,V> |
evictInBatchInternal(GridCacheVersion obsoleteVer)
Evicts entry when batch evict is performed.
|
boolean |
evictInternal(boolean swap,
GridCacheVersion obsoleteVer,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) |
long |
expireTime() |
long |
expireTimeExtras() |
long |
expireTimeUnlocked() |
byte[] |
getOrMarshalKeyBytes() |
int |
hashCode() |
boolean |
hasLockCandidate(GridCacheVersion ver)
Checks if the candidate is either owner or pending.
|
boolean |
hasLockCandidate(long threadId)
Checks if the candidate is either owner or pending.
|
boolean |
hasLockCandidateUnsafe(GridCacheVersion ver) |
boolean |
hasMeta(String name)
Tests whether or not given metadata is set.
|
protected boolean |
hasReaders() |
boolean |
hasValue() |
protected boolean |
hasValueUnlocked() |
GridCacheEntryInfo<K,V> |
info() |
boolean |
initialValue(K key,
GridCacheSwapEntry<V> unswapped)
Sets new value if current version is 0 using swap entry data.
|
boolean |
initialValue(V val,
byte[] valBytes,
GridCacheVersion ver,
long ttl,
long expireTime,
boolean preload,
long topVer,
GridDrType drType)
Sets new value if current version is 0
|
V |
innerGet(IgniteInternalTx<K,V> tx,
boolean readSwap,
boolean readThrough,
boolean failFast,
boolean unmarshal,
boolean updateMetrics,
boolean evt,
boolean tmp,
UUID subjId,
Object transformClo,
String taskName,
IgniteCacheExpiryPolicy expirePlc) |
V |
innerReload()
Reloads entry from underlying storage.
|
GridCacheUpdateTxResult<V> |
innerRemove(IgniteInternalTx<K,V> tx,
UUID evtNodeId,
UUID affNodeId,
boolean writeThrough,
boolean retval,
boolean evt,
boolean metrics,
long topVer,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
GridDrType drType,
GridCacheVersion explicitVer,
UUID subjId,
String taskName) |
GridCacheUpdateTxResult<V> |
innerSet(IgniteInternalTx<K,V> tx,
UUID evtNodeId,
UUID affNodeId,
V val,
byte[] valBytes,
boolean writeThrough,
boolean retval,
long ttl,
boolean evt,
boolean metrics,
long topVer,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
GridDrType drType,
long drExpireTime,
GridCacheVersion explicitVer,
UUID subjId,
String taskName) |
GridCacheUpdateAtomicResult<K,V> |
innerUpdate(GridCacheVersion newVer,
UUID evtNodeId,
UUID affNodeId,
GridCacheOperation op,
Object writeObj,
byte[] valBytes,
Object[] invokeArgs,
boolean writeThrough,
boolean retval,
IgniteCacheExpiryPolicy expiryPlc,
boolean evt,
boolean metrics,
boolean primary,
boolean verCheck,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
GridDrType drType,
long drTtl,
long drExpireTime,
GridCacheVersion drVer,
boolean drResolve,
boolean intercept,
UUID subjId,
String taskName) |
GridTuple3<Boolean,V,javax.cache.processor.EntryProcessorResult<Object>> |
innerUpdateLocal(GridCacheVersion ver,
GridCacheOperation op,
Object writeObj,
Object[] invokeArgs,
boolean writeThrough,
boolean retval,
javax.cache.expiry.ExpiryPolicy expiryPlc,
boolean evt,
boolean metrics,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
boolean intercept,
UUID subjId,
String taskName)
Update method for local cache in atomic mode.
|
boolean |
invalidate(GridCacheVersion curVer,
GridCacheVersion newVer)
Invalidates this entry.
|
boolean |
invalidate(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Invalidates this entry if it passes given filter.
|
boolean |
isDht() |
boolean |
isInternal() |
boolean |
isLocal() |
boolean |
isNear() |
boolean |
isNew()
Checks if entry is new assuming lock is held externally.
|
boolean |
isNewLocked()
Checks if entry is new while holding lock.
|
protected boolean |
isOffHeapValuesOnly() |
boolean |
isReplicated() |
boolean |
isStartVersion() |
protected boolean |
isStoreValueBytes() |
K |
key() |
byte[] |
keyBytes() |
void |
keyBytes(byte[] keyBytes) |
GridCacheMvccCandidate<K> |
localCandidate(long threadId) |
Collection<GridCacheMvccCandidate<K>> |
localCandidates(GridCacheVersion... exclude)
Gets all local candidates.
|
GridCacheMvccCandidate<K> |
localOwner() |
boolean |
lockedBy(GridCacheVersion ver) |
boolean |
lockedByAny(GridCacheVersion... exclude) |
boolean |
lockedByThread() |
boolean |
lockedByThread(long threadId) |
boolean |
lockedByThread(long threadId,
GridCacheVersion exclude) |
boolean |
lockedByThreadUnsafe(long threadId)
Will not fail for removed entries.
|
boolean |
lockedByUnsafe(GridCacheVersion ver) |
boolean |
lockedLocally(GridCacheVersion lockVer) |
boolean |
lockedLocallyByIdOrThread(GridCacheVersion lockVer,
long threadId) |
boolean |
lockedLocallyUnsafe(GridCacheVersion lockVer) |
boolean |
markObsolete(GridCacheVersion ver)
Sets obsolete flag if possible.
|
protected boolean |
markObsolete0(GridCacheVersion ver,
boolean clear)
Note that
onMarkedObsolete() should always be called after this method
returns true. |
boolean |
markObsoleteIfEmpty(GridCacheVersion ver)
Sets obsolete flag if entry value is
null or entry is expired and no
locks are held. |
boolean |
markObsoleteVersion(GridCacheVersion ver)
Sets obsolete flag if entry version equals to
ver. |
int |
memorySize() |
<V1> V1 |
meta(String name)
Gets metadata by name.
|
protected GridCacheMvcc<K> |
mvccExtras() |
protected void |
mvccExtras(GridCacheMvcc<K> mvcc) |
boolean |
obsolete() |
boolean |
obsolete(GridCacheVersion exclude) |
boolean |
obsoleteOrDeleted() |
GridCacheVersion |
obsoleteVersion() |
protected GridCacheVersion |
obsoleteVersionExtras() |
protected void |
obsoleteVersionExtras(GridCacheVersion obsoleteVer) |
protected void |
onInvalidate()
Called when entry invalidated.
|
void |
onMarkedObsolete()
This method should be called each time entry is marked obsolete
other than by calling
GridCacheEntryEx.markObsolete(GridCacheVersion). |
boolean |
onTtlExpired(GridCacheVersion obsoleteVer)
Callback from ttl processor to cache entry indicating that entry is expired.
|
int |
partition() |
boolean |
partitionValid() |
V |
peek(boolean heap,
boolean offheap,
boolean swap,
long topVer,
IgniteCacheExpiryPolicy expiryPlc)
Peeks into entry without loading value or updating statistics.
|
V |
peek(Collection<GridCachePeekMode> modes,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Peeks into entry without loading value or updating statistics.
|
V |
peek(GridCachePeekMode mode,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Peeks into entry without loading value or updating statistics.
|
GridTuple<V> |
peek0(boolean failFast,
GridCachePeekMode mode,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
IgniteInternalTx<K,V> tx) |
V |
peekFailFast(GridCachePeekMode mode,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
Peeks into entry without loading value or updating statistics.
|
V |
poke(V val)
This method overwrites current in-memory value with new value.
|
<V1> V1 |
putMetaIfAbsent(String name,
Callable<V1> c)
Adds given metadata value only if it was absent.
|
<V1> V1 |
putMetaIfAbsent(String name,
V1 val)
Adds given metadata value only if it was absent.
|
long |
rawExpireTime() |
V |
rawGet() |
V |
rawGetOrUnmarshal(boolean tmp) |
V |
rawGetOrUnmarshalUnlocked(boolean tmp) |
V |
rawPut(V val,
long ttl) |
long |
rawTtl() |
protected void |
readExternalMeta(ObjectInput in)
Convenience way for super-classes which implement
Externalizable to
serialize metadata. |
protected V |
readThrough(IgniteInternalTx<K,V> tx,
K key,
boolean reload,
UUID subjId,
String taskName) |
protected void |
recordNodeId(UUID nodeId) |
protected void |
releaseSwap() |
Collection<GridCacheMvccCandidate<K>> |
remoteMvccSnapshot(GridCacheVersion... exclude)
Gets all remote versions.
|
<V1> V1 |
removeMeta(String name)
Removes metadata by name.
|
<V1> boolean |
removeMeta(String name,
V1 val)
Removes metadata only if its current value is equal to
val passed in. |
<V1> boolean |
replaceMeta(String name,
V1 curVal,
V1 newVal)
Replaces given metadata with new
newVal value only if its current value
is equal to curVal. |
protected V |
saveValueForIndexUnlocked()
This method will return current value only if clearIndex(V) will require previous value (this is the case
for Mongo caches).
|
long |
startVersion() |
static long |
toExpireTime(long ttl) |
String |
toString() |
long |
ttl() |
protected void |
ttlAndExpireTimeExtras(long ttl,
long expireTime) |
long |
ttlExtras() |
IgniteTxKey<K> |
txKey() |
V |
unswap() |
V |
unswap(boolean ignoreFlags,
boolean needVal)
Unswaps an entry.
|
protected void |
update(V val,
byte[] valBytes,
long expireTime,
long ttl,
GridCacheVersion ver) |
protected void |
updateIndex(V val,
byte[] valBytes,
long expireTime,
GridCacheVersion ver,
V prevVal)
Updates cache index.
|
void |
updateTtl(GridCacheVersion ver,
long ttl) |
boolean |
valid(long topVer) |
protected void |
value(V val,
byte[] valBytes)
Sets entry value.
|
GridCacheValueBytes |
valueBytes() |
GridCacheValueBytes |
valueBytes(GridCacheVersion ver)
Gets cached serialized value bytes.
|
protected GridCacheValueBytes |
valueBytesUnlocked() |
GridCacheVersion |
version() |
GridCacheVersionedEntryEx<K,V> |
versionedEntry()
Create versioned entry for this cache entry.
|
boolean |
versionedValue(V val,
GridCacheVersion curVer,
GridCacheVersion newVer)
Sets new value if passed in version matches the current version
(used for read-through only).
|
boolean |
visitable(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) |
javax.cache.Cache.Entry<K,V> |
wrap()
Wraps this map entry into cache entry.
|
EvictableEntry<K,V> |
wrapEviction() |
javax.cache.Cache.Entry<K,V> |
wrapFilterLocked()
Wraps this map entry into cache entry for filter evaluation inside entry lock.
|
javax.cache.Cache.Entry<K,V> |
wrapLazyValue()
Wraps entry to an entry with lazy value get.
|
CacheVersionedEntryImpl<K,V> |
wrapVersioned() |
protected void |
writeExternalMeta(ObjectOutput out)
Convenience way for super-classes which implement
Externalizable to
serialize metadata. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitremoveLock, tmLock, txUnlockpublic static final Comparator<GridCacheVersion> ATOMIC_VER_COMPARATOR
protected static final AtomicReference<IgniteLogger> logRef
protected static volatile IgniteLogger log
@GridToStringExclude protected final GridCacheContext<K,V> cctx
@GridToStringInclude protected final K key
@GridToStringInclude protected V val
@GridToStringInclude protected final long startVer
@GridToStringInclude protected GridCacheVersion ver
@GridToStringExclude protected byte[] valBytes
@GridToStringInclude protected byte flags
IS_DELETED_MASKIS_UNSWAPPED_MASKprotected GridCacheMapEntry(GridCacheContext<K,V> cctx, K key, int hash, V val, GridCacheMapEntry<K,V> next, long ttl, int hdrId)
cctx - Cache context.key - Cache key.hash - Key hash value.val - Entry value.next - Next entry in the linked list.ttl - Time to live.hdrId - Header id.public long startVersion()
startVersion in interface GridCacheEntryEx<K,V>protected void value(@Nullable V val, @Nullable byte[] valBytes)
val - Value to store.valBytes - Value bytes to store.protected GridCacheValueBytes valueBytesUnlocked()
public int memorySize()
throws IgniteCheckedException
memorySize in interface GridCacheEntryEx<K,V>IgniteCheckedException - If failed.public boolean isInternal()
isInternal in interface GridCacheEntryEx<K,V>True if entry is internal cache entry.public boolean isDht()
isDht in interface GridCacheEntryEx<K,V>True if DHT.public boolean isLocal()
isLocal in interface GridCacheEntryEx<K,V>True if local.public boolean isNear()
isNear in interface GridCacheEntryEx<K,V>True if near.public boolean isReplicated()
isReplicated in interface GridCacheEntryEx<K,V>True if replicated.public boolean detached()
detached in interface GridCacheEntryEx<K,V>False if entry belongs to cache map, true if this entry was created in colocated
cache and node is not primary for this key.public GridCacheContext<K,V> context()
context in interface GridCacheEntryEx<K,V>public boolean isNew()
throws GridCacheEntryRemovedException
isNew in interface GridCacheEntryEx<K,V>True if entry is new.GridCacheEntryRemovedException - If entry was removed.public boolean isNewLocked()
throws GridCacheEntryRemovedException
isNewLocked in interface GridCacheEntryEx<K,V>True if entry is new.GridCacheEntryRemovedException - If entry was removed.public boolean isStartVersion()
True if start version.public boolean valid(long topVer)
valid in interface GridCacheEntryEx<K,V>topVer - Topology version where validation should be performed.
When negative the latest available topology should be used.public int partition()
partition in interface GridCacheEntryEx<K,V>public boolean partitionValid()
partitionValid in interface GridCacheEntryEx<K,V>True if partition is in valid.@Nullable public GridCacheEntryInfo<K,V> info()
info in interface GridCacheEntryEx<K,V>public V unswap() throws IgniteCheckedException
unswap in interface GridCacheEntryEx<K,V>IgniteCheckedException - If failed to read from swap storage.@Nullable public V unswap(boolean ignoreFlags, boolean needVal) throws IgniteCheckedException
unswap in interface GridCacheEntryEx<K,V>ignoreFlags - Whether to ignore swap flags.needVal - If false then do not to deserialize value during unswap.IgniteCheckedException - If failed.protected final void releaseSwap()
throws IgniteCheckedException
IgniteCheckedException - If failed.@Nullable protected V readThrough(@Nullable IgniteInternalTx<K,V> tx, K key, boolean reload, UUID subjId, String taskName) throws IgniteCheckedException
tx - Transaction.key - Key.reload - flag.subjId - Subject ID.taskName - Task name.IgniteCheckedException - If failed.@Nullable public final V innerGet(@Nullable IgniteInternalTx<K,V> tx, boolean readSwap, boolean readThrough, boolean failFast, boolean unmarshal, boolean updateMetrics, boolean evt, boolean tmp, UUID subjId, Object transformClo, String taskName, @Nullable IgniteCacheExpiryPolicy expirePlc) throws IgniteCheckedException, GridCacheEntryRemovedException
innerGet in interface GridCacheEntryEx<K,V>tx - Ongoing transaction (possibly null).readSwap - Flag indicating whether to check swap memory.readThrough - Flag indicating whether to read through.failFast - If true, then throw GridCacheFilterFailedException if
filter didn't pass.unmarshal - Unmarshal flag.updateMetrics - If true then metrics should be updated.evt - Flag to signal event notification.tmp - If true can return temporary instance which is valid while entry lock is held,
temporary object can used for filter evaluation or transform closure execution and
should not be returned to user.subjId - Subject ID initiated this read.transformClo - Transform closure to record event.taskName - Task name.
together with getting the value is an atomic operation.expirePlc - Expiry policy.IgniteCheckedException - If loading value failed.GridCacheEntryRemovedException - If entry was removed.@Nullable public final V innerReload() throws IgniteCheckedException, GridCacheEntryRemovedException
innerReload in interface GridCacheEntryEx<K,V>IgniteCheckedException - If reload failed.GridCacheEntryRemovedException - If entry has been removed.protected void recordNodeId(UUID nodeId)
nodeId - Node ID.public final GridCacheUpdateTxResult<V> innerSet(@Nullable IgniteInternalTx<K,V> tx, UUID evtNodeId, UUID affNodeId, V val, @Nullable byte[] valBytes, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, long topVer, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, GridDrType drType, long drExpireTime, @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId, String taskName) throws IgniteCheckedException, GridCacheEntryRemovedException
innerSet in interface GridCacheEntryEx<K,V>tx - Cache transaction.evtNodeId - ID of node responsible for this change.affNodeId - Partitioned node iD.val - Value to set.valBytes - Value bytes to set.writeThrough - If true then persist to storage.retval - True if value should be returned (and unmarshalled if needed).ttl - Time to live.evt - Flag to signal event notification.metrics - Flag to signal metrics update.topVer - Topology version.filter - Filter.drType - DR type.drExpireTime - DR expire time (if any).explicitVer - Explicit version (if any).subjId - Subject ID initiated this update.taskName - Task name.false,
then value is null.IgniteCheckedException - If storing value failed.GridCacheEntryRemovedException - If entry has been removed.public final GridCacheUpdateTxResult<V> innerRemove(@Nullable IgniteInternalTx<K,V> tx, UUID evtNodeId, UUID affNodeId, boolean writeThrough, boolean retval, boolean evt, boolean metrics, long topVer, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, GridDrType drType, @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId, String taskName) throws IgniteCheckedException, GridCacheEntryRemovedException
innerRemove in interface GridCacheEntryEx<K,V>tx - Cache transaction.evtNodeId - ID of node responsible for this change.affNodeId - Partitioned node iD.writeThrough - If true, persist to the storage.retval - True if value should be returned (and unmarshalled if needed).evt - Flag to signal event notification.metrics - Flag to signal metrics notification.topVer - Topology version.filter - Filter.drType - DR type.explicitVer - Explicit version (if any).subjId - Subject ID initiated this update.taskName - Task name.false,
then value is null.IgniteCheckedException - If remove failed.GridCacheEntryRemovedException - If entry has been removed.public GridTuple3<Boolean,V,javax.cache.processor.EntryProcessorResult<Object>> innerUpdateLocal(GridCacheVersion ver, GridCacheOperation op, @Nullable Object writeObj, @Nullable Object[] invokeArgs, boolean writeThrough, boolean retval, @Nullable javax.cache.expiry.ExpiryPolicy expiryPlc, boolean evt, boolean metrics, @Nullable IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, boolean intercept, @Nullable UUID subjId, String taskName) throws IgniteCheckedException, GridCacheEntryRemovedException
innerUpdateLocal in interface GridCacheEntryEx<K,V>ver - Cache version.op - Operation.writeObj - Value. Type depends on operation.invokeArgs - Optional arguments for EntryProcessor.writeThrough - Write through flag.retval - Return value flag.expiryPlc - Expiry policy..evt - Event flag.metrics - Metrics update flag.filter - Optional filter to check.intercept - If true then calls cache interceptor.subjId - Subject ID initiated this update.taskName - Task name.IgniteCheckedException - If update failed.GridCacheEntryRemovedException - If entry is obsolete.public GridCacheUpdateAtomicResult<K,V> innerUpdate(GridCacheVersion newVer, UUID evtNodeId, UUID affNodeId, GridCacheOperation op, @Nullable Object writeObj, @Nullable byte[] valBytes, @Nullable Object[] invokeArgs, boolean writeThrough, boolean retval, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean evt, boolean metrics, boolean primary, boolean verCheck, @Nullable IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, GridDrType drType, long drTtl, long drExpireTime, @Nullable GridCacheVersion drVer, boolean drResolve, boolean intercept, @Nullable UUID subjId, String taskName) throws IgniteCheckedException, GridCacheEntryRemovedException, GridClosureException
innerUpdate in interface GridCacheEntryEx<K,V>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.valBytes - Value bytes. Can be non-null only if operation is UPDATE.invokeArgs - Optional arguments for entry processor.writeThrough - Write 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.filter - Optional filter to check.drType - DR type.drTtl - DR TTL (if any).drExpireTime - DR expire time (if any).drVer - DR version (if any).drResolve - If true then performs DR conflicts resolution.intercept - If true then calls cache interceptor.subjId - Subject ID initiated this update.taskName - Task name.null if conflict resolution was not performed, the last boolean - whether update should be
propagated to backups or not.IgniteCheckedException - If update failed.GridCacheEntryRemovedException - If entry is obsolete.GridClosureExceptionprotected boolean hasReaders()
throws GridCacheEntryRemovedException
true if entry has readers. It makes sense only for dht entry.GridCacheEntryRemovedException - If removed.protected void clearReaders()
protected void clearReader(UUID nodeId) throws GridCacheEntryRemovedException
nodeId - Node ID to clear.GridCacheEntryRemovedExceptionpublic boolean clear(GridCacheVersion ver, boolean readers, @Nullable IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws IgniteCheckedException
clear in interface GridCacheEntryEx<K,V>ver - Obsolete version.readers - Flag to clear readers as well.filter - Optional entry filter.True if entry was not being used, passed the filter and could be removed.IgniteCheckedException - If failed to remove from swap.public GridCacheVersion obsoleteVersion()
obsoleteVersion in interface GridCacheEntryEx<K,V>public boolean markObsolete(GridCacheVersion ver)
markObsolete in interface GridCacheEntryEx<K,V>ver - Version to set as obsolete.True if entry is obsolete, false if
entry is still used by other threads or nodes.public boolean markObsoleteIfEmpty(@Nullable GridCacheVersion ver) throws IgniteCheckedException
null or entry is expired and no
locks are held.markObsoleteIfEmpty in interface GridCacheEntryEx<K,V>ver - Version to set as obsolete.True if entry was marked obsolete.IgniteCheckedException - If failed.public boolean markObsoleteVersion(GridCacheVersion ver)
ver.markObsoleteVersion in interface GridCacheEntryEx<K,V>ver - Version to compare with.True if marked obsolete.protected final boolean markObsolete0(GridCacheVersion ver, boolean clear)
Note that onMarkedObsolete() should always be called after this method
returns true.
ver - Version.clear - True to clear.True if entry is obsolete, false if entry is still used by other threads or nodes.public void onMarkedObsolete()
GridCacheEntryEx.markObsolete(GridCacheVersion).onMarkedObsolete in interface GridCacheEntryEx<K,V>public final boolean obsolete()
obsolete in interface GridCacheEntryEx<K,V>True if entry is obsolete.public final boolean obsolete(GridCacheVersion exclude)
obsolete in interface GridCacheEntryEx<K,V>exclude - Obsolete version to ignore.True if obsolete version is not null and is not the
passed in version.public boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer) throws IgniteCheckedException
invalidate in interface GridCacheEntryEx<K,V>curVer - Current version to match (null means always match).newVer - New version to set.true if entry is obsolete.IgniteCheckedException - If swap could not be released.protected void onInvalidate()
public boolean invalidate(@Nullable IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws GridCacheEntryRemovedException, IgniteCheckedException
invalidate in interface GridCacheEntryEx<K,V>filter - Optional filter that entry should pass before invalidation.true if entry was actually invalidated.GridCacheEntryRemovedException - If entry was removed.IgniteCheckedException - If swap could not be released.public boolean compact(@Nullable IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws GridCacheEntryRemovedException, IgniteCheckedException
compact in interface GridCacheEntryEx<K,V>filter - Optional filter that entry should pass before invalidation.true if entry was not being used and could be removed.GridCacheEntryRemovedException - If entry was removed.IgniteCheckedException - If operation failed.protected final void update(@Nullable V val, @Nullable byte[] valBytes, long expireTime, long ttl, GridCacheVersion ver)
val - New value.valBytes - New value bytes.expireTime - Expiration time.ttl - Time to live.ver - Update version.protected boolean isStoreValueBytes()
true If value bytes should be stored.protected boolean isOffHeapValuesOnly()
True if values should be stored off-heap.public static long toExpireTime(long ttl)
ttl - Time to live.protected void checkObsolete()
throws GridCacheEntryRemovedException
GridCacheEntryRemovedException - If entry is obsolete.public K key()
key in interface GridCacheEntryEx<K,V>public IgniteTxKey<K> txKey()
txKey in interface GridCacheEntryEx<K,V>public GridCacheVersion version() throws GridCacheEntryRemovedException
version in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry has been removed.@Nullable public V peek(GridCachePeekMode mode, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws GridCacheEntryRemovedException
peek in interface GridCacheEntryEx<K,V>mode - Peek mode.filter - Optional filter.GridCacheEntryRemovedException - If entry has been removed.@Nullable public V peek(boolean heap, boolean offheap, boolean swap, long topVer, @Nullable IgniteCacheExpiryPolicy expiryPlc) throws GridCacheEntryRemovedException, IgniteCheckedException
peek in interface GridCacheEntryEx<K,V>heap - Read from heap flag.offheap - Read from offheap flag.swap - Read from swap flag.topVer - Topology version.expiryPlc - Expiry policy if TTL should be updated.GridCacheEntryRemovedException - If entry has been removed.IgniteCheckedException - If failed.public V peek(Collection<GridCachePeekMode> modes, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws GridCacheEntryRemovedException
peek in interface GridCacheEntryEx<K,V>modes - Peek modes.filter - Optional filter.GridCacheEntryRemovedException - If entry has been removed.@Nullable public V peekFailFast(GridCachePeekMode mode, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter) throws GridCacheEntryRemovedException, GridCacheFilterFailedException
peekFailFast in interface GridCacheEntryEx<K,V>mode - Peek mode.filter - Optional filter.GridCacheEntryRemovedException - If entry has been removed.GridCacheFilterFailedException - If failFast is true and
filter didn't pass.@Nullable public GridTuple<V> peek0(boolean failFast, GridCachePeekMode mode, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, @Nullable IgniteInternalTx<K,V> tx) throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException
peek0 in interface GridCacheEntryEx<K,V>failFast - Fail-fast flag.mode - Peek mode.filter - Filter.tx - Transaction to peek value at (if mode is TX value).IgniteCheckedException - In case of error.GridCacheEntryRemovedException - If removed.GridCacheFilterFailedException - If filter failed.public V poke(V val) throws GridCacheEntryRemovedException, IgniteCheckedException
Note that this method is non-transactional and non-distributed and should almost never be used. It is meant to be used when fixing some heurisitic error state.
poke in interface GridCacheEntryEx<K,V>val - Value to set.GridCacheEntryRemovedException - if entry was unexpectedly removed.IgniteCheckedException - If poke operation failed.public V rawGet()
rawGet in interface GridCacheEntryEx<K,V>@Nullable public V rawGetOrUnmarshal(boolean tmp) throws IgniteCheckedException
rawGetOrUnmarshal in interface GridCacheEntryEx<K,V>tmp - If true can return temporary instance which is valid while entry lock is held,
temporary object can used for filter evaluation or transform closure execution and
should not be returned to user.IgniteCheckedException - If failed.@Nullable public V rawGetOrUnmarshalUnlocked(boolean tmp) throws IgniteCheckedException
tmp - If true can return temporary instance.IgniteCheckedException - If failed.public boolean hasValue()
hasValue in interface GridCacheEntryEx<K,V>True if has value or value bytes.protected boolean hasValueUnlocked()
True if this entry has value.public V rawPut(V val, long ttl)
rawPut in interface GridCacheEntryEx<K,V>val - New value.ttl - Time to live.public boolean initialValue(V val, byte[] valBytes, GridCacheVersion ver, long ttl, long expireTime, boolean preload, long topVer, GridDrType drType) throws IgniteCheckedException, GridCacheEntryRemovedException
initialValue in interface GridCacheEntryEx<K,V>val - New value.valBytes - Value bytes.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.True if initial value was set.IgniteCheckedException - In case of error.GridCacheEntryRemovedException - If entry was removed.public boolean initialValue(K key, GridCacheSwapEntry<V> unswapped) throws IgniteCheckedException, GridCacheEntryRemovedException
initialValue in interface GridCacheEntryEx<K,V>key - Key.unswapped - Swap entry to set entry state from.True if initial value was set.IgniteCheckedException - In case of error.GridCacheEntryRemovedException - If entry was removed.public GridCacheVersionedEntryEx<K,V> versionedEntry() throws IgniteCheckedException
versionedEntry in interface GridCacheEntryEx<K,V>IgniteCheckedException - In case of error.public boolean versionedValue(V val, GridCacheVersion curVer, GridCacheVersion newVer) throws IgniteCheckedException, GridCacheEntryRemovedException
versionedValue in interface GridCacheEntryEx<K,V>val - New value.curVer - Version to match or null if match is not required.newVer - Version to set.True if versioned matched.IgniteCheckedException - If index could not be updated.GridCacheEntryRemovedException - If entry was removed.public boolean hasLockCandidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
hasLockCandidate in interface GridCacheEntryEx<K,V>ver - Candidate version to check.True if the candidate is either owner or pending.GridCacheEntryRemovedException - If entry was removed.public boolean hasLockCandidate(long threadId)
throws GridCacheEntryRemovedException
hasLockCandidate in interface GridCacheEntryEx<K,V>threadId - ThreadId.True if the candidate is either owner or pending.GridCacheEntryRemovedException - If entry was removed.public boolean lockedByAny(GridCacheVersion... exclude) throws GridCacheEntryRemovedException
lockedByAny in interface GridCacheEntryEx<K,V>exclude - Exclude versions.True if lock is owned by any thread or node.GridCacheEntryRemovedException - If entry was removed.public boolean lockedByThread()
throws GridCacheEntryRemovedException
lockedByThread in interface GridCacheEntryEx<K,V>True if lock is owned by current thread.GridCacheEntryRemovedException - If entry was removed.public boolean lockedLocally(GridCacheVersion lockVer) throws GridCacheEntryRemovedException
lockedLocally in interface GridCacheEntryEx<K,V>lockVer - Lock ID to check.True if lock is owned by candidate.GridCacheEntryRemovedException - If entry was removed.public boolean lockedByThread(long threadId,
GridCacheVersion exclude)
throws GridCacheEntryRemovedException
lockedByThread in interface GridCacheEntryEx<K,V>threadId - Thread ID to check.exclude - Version to exclude from check.True if lock is owned by given thread.GridCacheEntryRemovedException - If entry was removed.public boolean lockedLocallyByIdOrThread(GridCacheVersion lockVer, long threadId) throws GridCacheEntryRemovedException
lockedLocallyByIdOrThread in interface GridCacheEntryEx<K,V>lockVer - Lock ID.threadId - Thread ID.True if locked either locally or by thread.GridCacheEntryRemovedException - If removed.public boolean lockedByThread(long threadId)
throws GridCacheEntryRemovedException
lockedByThread in interface GridCacheEntryEx<K,V>threadId - Thread ID to check.True if lock is owned by given thread.GridCacheEntryRemovedException - If entry was removed.public boolean lockedBy(GridCacheVersion ver) throws GridCacheEntryRemovedException
lockedBy in interface GridCacheEntryEx<K,V>ver - Version to check for ownership.True if owner has the specified version.GridCacheEntryRemovedException - If entry was removed.public boolean lockedByThreadUnsafe(long threadId)
lockedByThreadUnsafe in interface GridCacheEntryEx<K,V>threadId - Thread ID to check.True if lock is owned by given thread.public boolean lockedByUnsafe(GridCacheVersion ver)
lockedByUnsafe in interface GridCacheEntryEx<K,V>ver - Version to check for ownership.True if owner has the specified version.public boolean lockedLocallyUnsafe(GridCacheVersion lockVer)
lockedLocallyUnsafe in interface GridCacheEntryEx<K,V>lockVer - Lock ID to check.True if lock is owned by candidate.public boolean hasLockCandidateUnsafe(GridCacheVersion ver)
hasLockCandidateUnsafe in interface GridCacheEntryEx<K,V>ver - Lock version to check.True if has candidate with given lock ID.public Collection<GridCacheMvccCandidate<K>> localCandidates(GridCacheVersion... exclude) throws GridCacheEntryRemovedException
localCandidates in interface GridCacheEntryEx<K,V>exclude - Versions to exclude from check.GridCacheEntryRemovedException - If entry was removed.public Collection<GridCacheMvccCandidate<K>> remoteMvccSnapshot(GridCacheVersion... exclude)
remoteMvccSnapshot in interface GridCacheEntryEx<K,V>exclude - Exclude version.@Nullable public GridCacheMvccCandidate<K> candidate(GridCacheVersion ver) throws GridCacheEntryRemovedException
candidate in interface GridCacheEntryEx<K,V>ver - Lock version.GridCacheEntryRemovedException - If entry was removed.public GridCacheMvccCandidate<K> localCandidate(long threadId) throws GridCacheEntryRemovedException
localCandidate in interface GridCacheEntryEx<K,V>threadId - Thread ID.GridCacheEntryRemovedException - If entry was removed.public GridCacheMvccCandidate<K> candidate(UUID nodeId, long threadId) throws GridCacheEntryRemovedException
candidate in interface GridCacheEntryEx<K,V>nodeId - Node ID.threadId - Thread ID.GridCacheEntryRemovedException - If entry was removed.public GridCacheMvccCandidate<K> localOwner() throws GridCacheEntryRemovedException
localOwner in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry was removed.public long rawExpireTime()
rawExpireTime in interface GridCacheEntryEx<K,V>public long expireTime()
throws GridCacheEntryRemovedException
expireTime in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry was removed.public long expireTimeUnlocked()
expireTimeUnlocked in interface GridCacheEntryEx<K,V>public boolean onTtlExpired(GridCacheVersion obsoleteVer)
onTtlExpired in interface GridCacheEntryEx<K,V>obsoleteVer - Version to set obsolete if entry is expired.True if this entry was obsolete or became obsolete as a result of this call.public long rawTtl()
rawTtl in interface GridCacheEntryEx<K,V>public long ttl()
throws GridCacheEntryRemovedException
ttl in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry was removed.public void updateTtl(@Nullable GridCacheVersion ver, long ttl)
updateTtl in interface GridCacheEntryEx<K,V>ver - Version.ttl - Time to live.public void keyBytes(byte[] keyBytes)
throws GridCacheEntryRemovedException
keyBytes in interface GridCacheEntryEx<K,V>keyBytes - Key bytes.GridCacheEntryRemovedException - If entry was removed.public byte[] keyBytes()
keyBytes in interface GridCacheEntryEx<K,V>public byte[] getOrMarshalKeyBytes()
throws IgniteCheckedException
getOrMarshalKeyBytes in interface GridCacheEntryEx<K,V>IgniteCheckedException - If marshalling failed.public GridCacheValueBytes valueBytes() throws GridCacheEntryRemovedException
valueBytes in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry was removed.@Nullable public GridCacheValueBytes valueBytes(@Nullable GridCacheVersion ver) throws IgniteCheckedException, GridCacheEntryRemovedException
valueBytes in interface GridCacheEntryEx<K,V>ver - Version for which to get value bytes.IgniteCheckedException - If serialization failed.GridCacheEntryRemovedException - If entry was removed.protected void updateIndex(@Nullable V val, @Nullable byte[] valBytes, long expireTime, GridCacheVersion ver, @Nullable V prevVal) throws IgniteCheckedException
val - Value.valBytes - Value bytes.expireTime - Expire time.ver - New entry version.prevVal - Previous value.IgniteCheckedException - If update failed.protected void clearIndex(@Nullable V prevVal) throws IgniteCheckedException
prevVal - Previous value (if needed for index update).IgniteCheckedException - If failed.protected V saveValueForIndexUnlocked() throws IgniteCheckedException
null.null.IgniteCheckedException - If failed to retrieve previous value.public javax.cache.Cache.Entry<K,V> wrap()
wrap in interface GridCacheEntryEx<K,V>public javax.cache.Cache.Entry<K,V> wrapLazyValue()
wrapLazyValue in interface GridCacheEntryEx<K,V>public javax.cache.Cache.Entry<K,V> wrapFilterLocked() throws IgniteCheckedException
wrapFilterLocked in interface GridCacheEntryEx<K,V>IgniteCheckedException - If failed.public EvictableEntry<K,V> wrapEviction()
wrapEviction in interface GridCacheEntryEx<K,V>public CacheVersionedEntryImpl<K,V> wrapVersioned()
wrapVersioned in interface GridCacheEntryEx<K,V>public boolean evictInternal(boolean swap,
GridCacheVersion obsoleteVer,
@Nullable
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
throws IgniteCheckedException
evictInternal in interface GridCacheEntryEx<K,V>swap - Swap flag.obsoleteVer - Version for eviction.filter - Optional filter.True if entry could be evicted.IgniteCheckedException - In case of error.public GridCacheBatchSwapEntry<K,V> evictInBatchInternal(GridCacheVersion obsoleteVer) throws IgniteCheckedException
evictInBatchInternal in interface GridCacheEntryEx<K,V>obsoleteVer - Version to mark obsolete with.null if entry was not evicted.IgniteCheckedException - If failed.public boolean visitable(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
filter - Entry filter.True if entry is visitable.@Nullable public <V1> V1 addMeta(String name, V1 val)
addMeta in interface GridCacheEntryEx<K,V>V1 - Type of the value.name - Metadata name.val - Metadata value.null if there was none.@Nullable public <V1> V1 meta(String name)
meta in interface GridCacheEntryEx<K,V>V1 - Type of the value.name - Metadata name.null.@Nullable public <V1> V1 removeMeta(String name)
removeMeta in interface GridCacheEntryEx<K,V>V1 - Type of the value.name - Name of the metadata to remove.null.public <V1> boolean removeMeta(String name, V1 val)
val passed in.removeMeta in interface GridCacheEntryEx<K,V>V1 - Value type.name - Name of metadata attribute.val - Value to compare.True if value was removed, false otherwise.public boolean hasMeta(String name)
hasMeta in interface GridCacheEntryEx<K,V>name - Name of the metadata to test.@Nullable public <V1> V1 putMetaIfAbsent(String name, V1 val)
putMetaIfAbsent in interface GridCacheEntryEx<K,V>V1 - Type of the value.name - Metadata name.val - Value to add if it's not attached already.null if new value was put, or current value if put didn't happen.@Nullable public <V1> V1 putMetaIfAbsent(String name, Callable<V1> c)
putMetaIfAbsent in interface GridCacheEntryEx<K,V>V1 - Type of the value.name - Metadata name.c - Factory closure to produce value to add if it's not attached already.
Not that unlike GridCacheEntryEx.addMeta(String, Object) method the factory closure will
not be called unless the value is required and therefore value will only be created
when it is actually needed.null if new value was put, or current value if put didn't happen.public <V1> boolean replaceMeta(String name, V1 curVal, V1 newVal)
newVal value only if its current value
is equal to curVal. Otherwise, it is no-op.replaceMeta in interface GridCacheEntryEx<K,V>name - Name of the metadata.curVal - Current value to check.newVal - New value.true if replacement occurred, false otherwise.protected void writeExternalMeta(ObjectOutput out) throws IOException
Externalizable to
serialize metadata. Super-classes must call this method explicitly from
within Externalizable.writeExternal(ObjectOutput) methods implementation.out - Output to write to.IOException - If I/O error occurred.protected void readExternalMeta(ObjectInput in) throws IOException, ClassNotFoundException
Externalizable to
serialize metadata. Super-classes must call this method explicitly from
within Externalizable.readExternal(ObjectInput) methods implementation.in - Input to read from.IOException - If I/O error occurred.ClassNotFoundException - If some class could not be found.public boolean deleted()
deleted in interface GridCacheEntryEx<K,V>True if entry has been already deleted.public boolean obsoleteOrDeleted()
obsoleteOrDeleted in interface GridCacheEntryEx<K,V>True if entry is obsolete or deleted.GridCacheEntryEx.deleted()protected boolean deletedUnlocked()
True if deleted.protected void deletedUnlocked(boolean deleted)
deleted - True if deleted.@Nullable protected GridCacheMvcc<K> mvccExtras()
protected void mvccExtras(@Nullable GridCacheMvcc<K> mvcc)
mvcc - MVCC.@Nullable protected GridCacheVersion obsoleteVersionExtras()
protected void obsoleteVersionExtras(@Nullable GridCacheVersion obsoleteVer)
obsoleteVer - Obsolete version.public long ttlExtras()
public long expireTimeExtras()
protected void ttlAndExpireTimeExtras(long ttl,
long expireTime)
ttl - TTL.expireTime - Expire time.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015