public abstract class GridCacheMapEntry<K,V> extends Object implements GridCacheEntryEx<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected GridCacheContext<K,V> |
cctx
Cache registry.
|
protected byte |
flags
Flags:
Refreshing flag - mask
IS_REFRESHING_MASK
Deleted flag - mask IS_DELETED_MASK
|
protected K |
key
Key.
|
protected static GridLogger |
log
Logger.
|
protected static AtomicReference<GridLogger> |
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 |
|---|---|
<V> V |
addMeta(String name,
V val)
Adds a new metadata.
|
<V> V |
addMetaIfAbsent(String name,
Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
addMetaIfAbsent(String name,
V val)
Adds given metadata value only if it was absent.
|
<V> Map<String,V> |
allMeta()
Gets all metadata in this entry.
|
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,
GridPredicate<GridCacheEntry<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 |
clearReaders() |
boolean |
compact(GridPredicate<GridCacheEntry<K,V>>[] filter)
Optimizes the size of this entry.
|
GridCacheContext<K,V> |
context() |
void |
copyMeta(GridMetadataAware from)
Copies all metadata from another instance.
|
void |
copyMeta(Map<String,?> attrData)
Copies all metadata from given map.
|
protected GridCacheValueBytes |
createValueBytes(V val)
Create value bytes wrapper from the given object.
|
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() |
GridDrEntry<K,V> |
drEntry()
Create DR entry for that cache entry.
|
boolean |
equals(Object o) |
GridCacheBatchSwapEntry<K,V> |
evictInBatchInternal(GridCacheVersion obsoleteVer)
Evicts entry when batch evict is performed.
|
boolean |
evictInternal(boolean swap,
GridCacheVersion obsoleteVer,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
GridCacheEntry<K,V> |
evictWrap() |
long |
expireTime() |
protected 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.
|
<V> boolean |
hasMeta(String name,
V val)
Tests whether or not metadata with given name and value 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(GridCacheTxEx<K,V> tx,
boolean readSwap,
boolean readThrough,
boolean failFast,
boolean unmarshal,
boolean updateMetrics,
boolean evt,
UUID subjId,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
V |
innerReload(GridPredicate<GridCacheEntry<K,V>>[] filter)
Reloads entry from underlying storage.
|
GridCacheUpdateTxResult<V> |
innerRemove(GridCacheTxEx<K,V> tx,
UUID evtNodeId,
UUID affNodeId,
boolean writeThrough,
boolean retval,
boolean evt,
boolean metrics,
long topVer,
GridPredicate<GridCacheEntry<K,V>>[] filter,
GridDrType drType,
GridCacheVersion explicitVer,
UUID subjId) |
GridCacheUpdateTxResult<V> |
innerSet(GridCacheTxEx<K,V> tx,
UUID evtNodeId,
UUID affNodeId,
V val,
byte[] valBytes,
boolean writeThrough,
boolean retval,
long ttl,
boolean evt,
boolean metrics,
long topVer,
GridPredicate<GridCacheEntry<K,V>>[] filter,
GridDrType drType,
long drExpireTime,
GridCacheVersion explicitVer,
UUID subjId) |
GridCacheUpdateAtomicResult<K,V> |
innerUpdate(GridCacheVersion newVer,
UUID evtNodeId,
UUID affNodeId,
GridCacheOperation op,
Object writeObj,
byte[] valBytes,
boolean writeThrough,
boolean retval,
long ttl,
boolean evt,
boolean metrics,
boolean primary,
boolean verCheck,
GridPredicate<GridCacheEntry<K,V>>[] filter,
GridDrType drType,
long drTtl,
long drExpireTime,
GridCacheVersion drVer,
boolean drResolve,
boolean intercept,
UUID subjId) |
GridBiTuple<Boolean,V> |
innerUpdateLocal(GridCacheVersion ver,
GridCacheOperation op,
Object writeObj,
boolean writeThrough,
boolean retval,
long ttl,
boolean evt,
boolean metrics,
GridPredicate<GridCacheEntry<K,V>>[] filter,
boolean intercept,
UUID subjId)
Update method for local cache in atomic mode.
|
boolean |
invalidate(GridCacheVersion curVer,
GridCacheVersion newVer)
Invalidates this entry.
|
boolean |
invalidate(GridPredicate<GridCacheEntry<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() |
protected 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() |
<V> V |
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(Collection<GridCachePeekMode> modes,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Peeks into entry without loading value or updating statistics.
|
V |
peek(GridCachePeekMode mode,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Peeks into entry without loading value or updating statistics.
|
GridTuple<V> |
peek0(boolean failFast,
GridCachePeekMode mode,
GridPredicate<GridCacheEntry<K,V>>[] filter,
GridCacheTxEx<K,V> tx) |
V |
peekFailFast(GridCachePeekMode mode,
GridPredicate<GridCacheEntry<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.
|
<V> V |
putMetaIfAbsent(String name,
Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
putMetaIfAbsent(String name,
V val)
Adds given metadata value only if it was absent.
|
long |
rawExpireTime() |
V |
rawGet() |
V |
rawGetOrUnmarshal() |
protected V |
rawGetOrUnmarshalUnlocked() |
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(GridCacheTxEx<K,V> tx,
K key,
boolean reload,
GridPredicate<GridCacheEntry<K,V>>[] filter,
UUID subjId) |
protected void |
recordNodeId(UUID nodeId) |
protected void |
refreshAhead(K key,
GridCacheVersion matchVer) |
protected void |
refreshingLocked(boolean refreshing) |
protected boolean |
refreshingUnlocked() |
protected void |
releaseSwap() |
Collection<GridCacheMvccCandidate<K>> |
remoteMvccSnapshot(GridCacheVersion... exclude)
Gets all remote versions.
|
<V> V |
removeMeta(String name)
Removes metadata by name.
|
<V> boolean |
removeMeta(String name,
V val)
Removes metadata only if its current value is equal to
val passed in. |
<V> boolean |
replaceMeta(String name,
V curVal,
V 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() |
protected long |
toExpireTime(long ttl) |
String |
toString() |
long |
ttl() |
protected void |
ttlAndExpireTimeExtras(long ttl,
long expireTime) |
protected long |
ttlExtras() |
V |
unswap()
Unswaps an entry.
|
V |
unswap(boolean ignoreFlags)
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.
|
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() |
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(GridPredicate<GridCacheEntry<K,V>>[] filter) |
GridCacheEntry<K,V> |
wrap(boolean prjAware)
Wraps this map entry into cache entry.
|
GridCacheEntry<K,V> |
wrapFilterLocked()
Wraps this map entry into cache entry for filter evaluation inside entry lock.
|
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, txUnlockprotected static final AtomicReference<GridLogger> logRef
protected static volatile GridLogger 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_REFRESHING_MASKIS_DELETED_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 GridException
memorySize in interface GridCacheEntryEx<K,V>GridException - 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.protected 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 GridException
unswap in interface GridCacheEntryEx<K,V>GridException - If failed.public V unswap(boolean ignoreFlags) throws GridException
unswap in interface GridCacheEntryEx<K,V>ignoreFlags - Whether to ignore swap flags.GridException - If failed.protected final void releaseSwap()
throws GridException
GridException - If failed.protected void refreshAhead(K key, GridCacheVersion matchVer)
key - Key.matchVer - Version to match.@Nullable protected V readThrough(@Nullable GridCacheTxEx<K,V> tx, K key, boolean reload, GridPredicate<GridCacheEntry<K,V>>[] filter, UUID subjId) throws GridException
tx - Transaction.key - Key.reload - flag.filter - Filter.GridException - If failed.@Nullable public final V innerGet(@Nullable GridCacheTxEx<K,V> tx, boolean readSwap, boolean readThrough, boolean failFast, boolean unmarshal, boolean updateMetrics, boolean evt, UUID subjId, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException, GridCacheEntryRemovedException, GridCacheFilterFailedException
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.subjId - Subject ID initiated this read.filter - Filter to check prior to getting the value. Note that filter check
together with getting the value is an atomic operation.GridException - If loading value failed.GridCacheEntryRemovedException - If entry was removed.GridCacheFilterFailedException - If filter failed.@Nullable public final V innerReload(GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException, GridCacheEntryRemovedException
innerReload in interface GridCacheEntryEx<K,V>filter - Filter for entries.GridException - If reload failed.GridCacheEntryRemovedException - If entry has been removed.protected void recordNodeId(UUID nodeId)
nodeId - Node ID.public final GridCacheUpdateTxResult<V> innerSet(@Nullable GridCacheTxEx<K,V> tx, UUID evtNodeId, UUID affNodeId, V val, @Nullable byte[] valBytes, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, long topVer, GridPredicate<GridCacheEntry<K,V>>[] filter, GridDrType drType, long drExpireTime, @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId) throws GridException, 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.filter - Filter.drType - DR type.drExpireTime - DR expire time (if any).explicitVer - Explicit version (if any).false,
then value is null.GridException - If storing value failed.GridCacheEntryRemovedException - If entry has been removed.public final GridCacheUpdateTxResult<V> innerRemove(@Nullable GridCacheTxEx<K,V> tx, UUID evtNodeId, UUID affNodeId, boolean writeThrough, boolean retval, boolean evt, boolean metrics, long topVer, GridPredicate<GridCacheEntry<K,V>>[] filter, GridDrType drType, @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId) throws GridException, 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.filter - Filter.drType - DR type.explicitVer - Explicit version (if any).false,
then value is null.GridException - If remove failed.GridCacheEntryRemovedException - If entry has been removed.public GridBiTuple<Boolean,V> innerUpdateLocal(GridCacheVersion ver, GridCacheOperation op, @Nullable Object writeObj, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter, boolean intercept, @Nullable UUID subjId) throws GridException, GridCacheEntryRemovedException
innerUpdateLocal in interface GridCacheEntryEx<K,V>ver - Cache version.op - Operation.writeObj - Value. Type depends on operation.writeThrough - Write through flag.retval - Return value flag.ttl - Time to live.evt - Event flag.metrics - Metrics update flag.filter - Optional filter to check.intercept - If true then calls cache interceptor.GridException - 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, boolean writeThrough, boolean retval, long ttl, boolean evt, boolean metrics, boolean primary, boolean verCheck, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter, GridDrType drType, long drTtl, long drExpireTime, @Nullable GridCacheVersion drVer, boolean drResolve, boolean intercept, @Nullable UUID subjId) throws GridException, 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.writeThrough - Write through flag.retval - Return value flag.ttl - Time to live.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.null if conflict resolution was not performed, the last boolean - whether update should be
propagated to backups or not.GridException - 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()
public boolean clear(GridCacheVersion ver, boolean readers, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
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.GridException - 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 GridException
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.GridException - 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 GridException
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.GridException - If swap could not be released.protected void onInvalidate()
public boolean invalidate(@Nullable GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridCacheEntryRemovedException, GridException
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.GridException - If swap could not be released.public boolean compact(@Nullable GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridCacheEntryRemovedException, GridException
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.GridException - 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.protected 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 GridCacheVersion version() throws GridCacheEntryRemovedException
version in interface GridCacheEntryEx<K,V>GridCacheEntryRemovedException - If entry has been removed.@Nullable public V peek(GridCachePeekMode mode, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridCacheEntryRemovedException
peek in interface GridCacheEntryEx<K,V>mode - Peek mode.filter - Optional filter.GridCacheEntryRemovedException - If entry has been removed.public V peek(Collection<GridCachePeekMode> modes, GridPredicate<GridCacheEntry<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, GridPredicate<GridCacheEntry<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, GridPredicate<GridCacheEntry<K,V>>[] filter, @Nullable GridCacheTxEx<K,V> tx) throws GridCacheEntryRemovedException, GridCacheFilterFailedException, GridException
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).GridException - In case of error.GridCacheEntryRemovedException - If removed.GridCacheFilterFailedException - If filter failed.public V poke(V val) throws GridCacheEntryRemovedException, GridException
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.GridException - If poke operation failed.public V rawGet()
rawGet in interface GridCacheEntryEx<K,V>public V rawGetOrUnmarshal() throws GridException
rawGetOrUnmarshal in interface GridCacheEntryEx<K,V>GridException - If failed.protected V rawGetOrUnmarshalUnlocked() throws GridException
GridException - 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 GridDrEntry<K,V> drEntry() throws GridException
drEntry in interface GridCacheEntryEx<K,V>GridException - If failed.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 GridException, 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.drType - DR type.True if initial value was set.GridException - In case of error.GridCacheEntryRemovedException - If entry was removed.public boolean initialValue(K key, GridCacheSwapEntry<V> unswapped) throws GridException, GridCacheEntryRemovedException
initialValue in interface GridCacheEntryEx<K,V>key - Key.unswapped - Swap entry to set entry state from.True if initial value was set.GridException - In case of error.GridCacheEntryRemovedException - If entry was removed.public boolean versionedValue(V val, GridCacheVersion curVer, GridCacheVersion newVer) throws GridException, 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.GridException - 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 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 GridException
getOrMarshalKeyBytes in interface GridCacheEntryEx<K,V>GridException - 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 GridException, GridCacheEntryRemovedException
valueBytes in interface GridCacheEntryEx<K,V>ver - Version for which to get value bytes.GridException - 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 GridException
val - Value.valBytes - Value bytes.expireTime - Expire time.ver - New entry version.prevVal - Previous value.GridException - If update failed.protected void clearIndex(@Nullable V prevVal) throws GridException
prevVal - Previous value (if needed for index update).GridException - If failed.protected V saveValueForIndexUnlocked() throws GridException
null.null.GridException - If failed to retrieve previous value.public GridCacheEntry<K,V> wrap(boolean prjAware)
wrap in interface GridCacheEntryEx<K,V>prjAware - true if entry should inherit projection properties.public GridCacheEntry<K,V> wrapFilterLocked() throws GridException
wrapFilterLocked in interface GridCacheEntryEx<K,V>GridException - If failed.public GridCacheEntry<K,V> evictWrap()
evictWrap in interface GridCacheEntryEx<K,V>public boolean evictInternal(boolean swap,
GridCacheVersion obsoleteVer,
@Nullable
GridPredicate<GridCacheEntry<K,V>>[] filter)
throws GridException
evictInternal in interface GridCacheEntryEx<K,V>swap - Swap flag.obsoleteVer - Version for eviction.filter - Optional filter.True if entry could be evicted.GridException - In case of error.public GridCacheBatchSwapEntry<K,V> evictInBatchInternal(GridCacheVersion obsoleteVer) throws GridException
evictInBatchInternal in interface GridCacheEntryEx<K,V>obsoleteVer - Version to mark obsolete with.null if entry was not evicted.GridException - If failed.protected GridCacheValueBytes createValueBytes(@Nullable V val) throws GridException
val - Value.GridException - If failed.public boolean visitable(GridPredicate<GridCacheEntry<K,V>>[] filter)
filter - Entry filter.True if entry is visitable.public void copyMeta(GridMetadataAware from)
copyMeta in interface GridMetadataAwarefrom - Metadata aware instance to copy metadata from.public void copyMeta(Map<String,?> attrData)
copyMeta in interface GridMetadataAwareattrData - Map to copy metadata from.@Nullable public <V> V addMeta(String name, V val)
addMeta in interface GridMetadataAwareV - Type of the value.name - Metadata name.val - Metadata value.null if there was none.@Nullable public <V> V meta(String name)
meta in interface GridMetadataAwareV - Type of the value.name - Metadata name.null.@Nullable public <V> V removeMeta(String name)
removeMeta in interface GridMetadataAwareV - Type of the value.name - Name of the metadata to remove.null.public <V> boolean removeMeta(String name, V val)
val passed in.removeMeta in interface GridMetadataAwareV - Value type.name - Name of metadata attribute.val - Value to compare.True if value was removed, false otherwise.public <V> Map<String,V> allMeta()
allMeta in interface GridMetadataAwareV - Type of the value.public boolean hasMeta(String name)
hasMeta in interface GridMetadataAwarename - Name of the metadata to test.public <V> boolean hasMeta(String name, V val)
true if
attachment with given name it set and its value is equals to provided value. Otherwise returns
false.hasMeta in interface GridMetadataAwareV - Type of the value.name - Name of the metadata.val - Value to compare. Cannot be null.true if metadata with given name is set and its value is equals to provided value -
otherwise returns false.@Nullable public <V> V putMetaIfAbsent(String name, V val)
putMetaIfAbsent in interface GridMetadataAwareV - 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 <V> V putMetaIfAbsent(String name, Callable<V> c)
putMetaIfAbsent in interface GridMetadataAwareV - Type of the value.name - Metadata name.c - Factory closure to produce value to add if it's not attached already.
Not that unlike GridMetadataAware.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 <V> V addMetaIfAbsent(String name, V val)
GridMetadataAware.putMetaIfAbsent(String, Callable), this method always returns
the latest value and never previous one.addMetaIfAbsent in interface GridMetadataAwareV - Type of the value.name - Metadata name.val - Value to add if it's not attached already.@Nullable public <V> V addMetaIfAbsent(String name, @Nullable Callable<V> c)
addMetaIfAbsent in interface GridMetadataAwareV - Type of the value.name - Metadata name.c - Factory closure to produce value to add if it's not attached already.
Not that unlike GridMetadataAware.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. If null and metadata value is missing - null
will be returned from this method.public <V> boolean replaceMeta(String name, V curVal, V newVal)
newVal value only if its current value
is equal to curVal. Otherwise, it is no-op.replaceMeta in interface GridMetadataAwarename - 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.protected boolean refreshingUnlocked()
True if refreshing.protected void refreshingLocked(boolean refreshing)
refreshing - True if refreshing.@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.protected long ttlExtras()
protected long expireTimeExtras()
protected void ttlAndExpireTimeExtras(long ttl,
long expireTime)
ttl - TTL.expireTime - Expire time.Copyright © 2014. All rights reserved.