@GridToStringExclude public class GridDhtAtomicCache<K,V> extends GridDhtCacheAdapter<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
GridDhtAtomicCache.DhtAtomicUpdateRequestConverter603 |
static class |
GridDhtAtomicCache.DhtAtomicUpdateResponseConverter603 |
static class |
GridDhtAtomicCache.GridDhtAtomicUpdateRequestConverter612
GridDhtAtomicUpdateRequest converter for version 6.1.2
|
static class |
GridDhtAtomicCache.GridNearAtomicUpdateRequestConverter612
GridNearAtomicUpdateRequest converter for version 6.1.2
|
static class |
GridDhtAtomicCache.NearAtomicUpdateResponseConverter603 |
GridDhtCacheAdapter.GridSubjectIdAddedMessageConverter616GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.FutureHolder| Modifier and Type | Field and Description |
|---|---|
static GridProductVersion |
FORCE_TRANSFORM_BACKUP_SINCE
Version where FORCE_TRANSFORM_BACKUP flag was introduced.
|
preldr, SUBJECT_ID_EVENTS_SINCE_VERafterPessimisticUnlock, beforePessimisticLock, cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, gridCfg, lastFut, locNodeId, log, map, metrics| Constructor and Description |
|---|
GridDhtAtomicCache()
Empty constructor required by
Externalizable. |
GridDhtAtomicCache(GridCacheContext<K,V> ctx) |
GridDhtAtomicCache(GridCacheContext<K,V> ctx,
GridCacheConcurrentMap<K,V> map) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> GridFuture<T> |
asyncOp(CO<GridFuture<T>> op) |
GridCacheEntry<K,V> |
entry(K key)
Gets entry from cache with the specified key.
|
GridFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
GridCacheEntryEx<K,V> entry,
UUID subjId,
GridPredicate<GridCacheEntry<K,V>>[] filter)
This method is used internally.
|
protected void |
init()
Post constructor initialization for subclasses.
|
boolean |
isDhtAtomic() |
protected GridFuture<Boolean> |
lockAllAsync(Collection<? extends K> keys,
long timeout,
GridCacheTxLocalEx<K,V> tx,
boolean isInvalidate,
boolean isRead,
boolean retval,
GridCacheTxIsolation isolation,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
GridNearCacheAdapter<K,V> |
near() |
void |
near(GridNearAtomicCache<K,V> near) |
GridCacheTxLocalAdapter<K,V> |
newTx(boolean implicit,
boolean implicitSingle,
GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation,
long timeout,
boolean invalidate,
boolean syncCommit,
boolean syncRollback,
boolean swapOrOffheapEnabled,
boolean storeEnabled,
int txSize,
Object grpLockKey,
boolean partLock) |
V |
peek(K key,
Collection<GridCachePeekMode> modes)
Peeks at cached value using optional set of peek modes.
|
V |
put(K key,
V val,
GridCacheEntryEx<K,V> cached,
long ttl,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Internal method that is called from
GridCacheEntryImpl. |
void |
putAll(Map<? extends K,? extends V> m,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Stores given key-value pairs in cache.
|
GridFuture<?> |
putAllAsync(Map<? extends K,? extends V> m,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously stores given key-value pairs in cache.
|
void |
putAllDr(Map<? extends K,GridCacheDrInfo<V>> drMap)
Store DR data.
|
GridFuture<?> |
putAllDrAsync(Map<? extends K,GridCacheDrInfo<V>> drMap)
Store DR data asynchronously.
|
GridFuture<V> |
putAsync(K key,
V val,
GridCacheEntryEx<K,V> entry,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
V |
putIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
GridFuture<V> |
putIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
boolean |
putx(K key,
V val,
GridCacheEntryEx<K,V> cached,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
putx(K key,
V val,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Stores given key-value pair in cache.
|
GridFuture<Boolean> |
putxAsync(K key,
V val,
GridCacheEntryEx<K,V> entry,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
putxIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
GridFuture<Boolean> |
putxIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
V |
remove(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
remove(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
void |
removeAll(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>>... filter)
Removes given key mappings from cache for entries for which the optionally passed in filters do
pass.
|
void |
removeAll(GridPredicate<GridCacheEntry<K,V>>[] filter)
Removes mappings from cache for entries for which the optionally passed in filters do
pass.
|
GridFuture<?> |
removeAllAsync(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously removes given key mappings from cache for entries for which the optionally
passed in filters do pass.
|
GridFuture<?> |
removeAllAsync(GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously removes mappings from cache for entries for which the optionally passed in filters do
pass.
|
void |
removeAllDr(Map<? extends K,GridCacheVersion> drMap)
Removes DR data.
|
GridFuture<?> |
removeAllDrAsync(Map<? extends K,GridCacheVersion> drMap)
Removes DR data asynchronously.
|
GridFuture<V> |
removeAsync(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridFuture<Boolean> |
removeAsync(K key,
V val)
Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
|
boolean |
removex(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridCacheReturn<V> |
removex(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
GridFuture<Boolean> |
removexAsync(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridFuture<GridCacheReturn<V>> |
removexAsync(K key,
V val)
Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
|
V |
replace(K key,
V val)
Stores given key-value pair in cache only if if there is a previous mapping for it.
|
boolean |
replace(K key,
V oldVal,
V newVal)
Stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
GridFuture<V> |
replaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if if there is a previous mapping for it.
|
GridFuture<Boolean> |
replaceAsync(K key,
V oldVal,
V newVal)
Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
boolean |
replacex(K key,
V val)
Stores given key-value pair in cache only if only if there is a previous mapping for it.
|
GridCacheReturn<V> |
replacex(K key,
V oldVal,
V newVal)
Stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
GridFuture<Boolean> |
replacexAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.
|
GridFuture<GridCacheReturn<V>> |
replacexAsync(K key,
V oldVal,
V newVal)
Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
void |
resetMetrics()
Resets metrics for current cache.
|
void |
start()
Starts this cache.
|
String |
toString() |
void |
transform(K key,
GridClosure<V,V> transformer)
Stores result of applying
valTransform closure to the previous value associated with
given key in cache. |
void |
transformAll(Map<? extends K,? extends GridClosure<V,V>> m)
Stores result of applying transform closures from the given map to previous values associated
with corresponding keys in cache.
|
GridFuture<?> |
transformAllAsync(Map<? extends K,? extends GridClosure<V,V>> m)
Stores result of applying transform closures from the given map to previous values associated
with corresponding keys in cache.
|
<R> R |
transformAndCompute(K key,
GridClosure<V,GridBiTuple<V,R>> transformer)
Applies
transformer closure to the previous value associated with given key in cache,
closure should return GridBiTuple instance where first value is new value stored in cache
and second value is returned as result of this method. |
GridFuture<?> |
transformAsync(K key,
GridClosure<V,V> transformer,
GridCacheEntryEx<K,V> entry,
long ttl)
Internal method that is called from
GridCacheEntryImpl. |
void |
updateAllAsyncInternal(UUID nodeId,
GridNearAtomicUpdateRequest<K,V> req,
GridCacheEntryEx<K,V> cached,
CI2<GridNearAtomicUpdateRequest<K,V>,GridNearAtomicUpdateResponse<K,V>> completionCb)
Executes local update.
|
void |
updateAllAsyncInternal0(UUID nodeId,
GridNearAtomicUpdateRequest<K,V> req,
GridCacheEntryEx<K,V> cached,
CI2<GridNearAtomicUpdateRequest<K,V>,GridNearAtomicUpdateResponse<K,V>> completionCb)
Executes local update after preloader fetched values.
|
beginMultiUpdate, dhtPreloader, endMultiUpdate, entryEx, entryEx, entryExx, entryExx, entryExx, entrySet, getDhtAsync, loadCache, multiUpdateFinishFuture, multiUpdateTopologyFuture, onDeferredDelete, onKernalStart, onKernalStop, peekExx, preloader, primarySize, printMemoryStats, processNearGetRequest, reload, splitClearAll, stop, topology, unlockAlllockAllAsync, removeVersionedEntry, txLockAsyncaffinity, afterPessimisticUnlock, afterPessimisticUnlock, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, beforePessimisticLock, beforePessimisticLock, cache, checkJta, clear, clear0, clearAll, clearAll, clearAll0, compact, compact, compactAll, compactAll, configuration, containsAllKeys, containsAllValues, containsAnyKeys, containsAnyValues, containsKey, containsKey, containsValue, containsValue, context, dataStructures, dgc, dgc, drBackupQueueSize, drListStateTransfers, drPause, drPauseState, drResume, drStateTransfer, entries, entryEx, entryExSafe, entrySet, entrySet, entrySet, entrySetx, evict, evict, evictAll, evictAll, evictAll, flags, flagsOff, flagsOn, forAll, forceRepartition, forEach, forSubjectId, get, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllOutTx, getAllOutTxAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, ggfsDataSpaceMax, ggfsDataSpaceUsed, globalClearAll, gridProjection, isColocated, isDht, isDrSystemCache, isEmpty, isGgfsDataCache, isLocal, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, keySet, keySet, loadCacheAsync, lock, lockAll, lockAsync, log, map, metrics, metrics0, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, offHeapIterator, onGgfsDataSizeChanged, onUndeploy, overflowSize, peek, peek, peek0, peek0, peek0, peekAll, peekAll0, peekAll0, peekEx, predicate, primaryEntrySet, primaryEntrySet, primaryKeySet, primaryKeySet, primaryValues, primaryValues, processCheckCommittedTxRequest, processCheckCommittedTxResponse, processCheckPreparedTxRequest, processCheckPreparedTxResponse, projection, projection, projection, promote, promoteAll, put, putAsync, putxAsync, queries, randomEntry, readExternal, readResolve, readThroughAllAsync, reload, reloadAll, reloadAll, reloadAll, reloadAll, reloadAll, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAsync, reloadAsync, remove, removeAsync, removeEntry, removeIfObsolete, removex, removexAsync, saveFuture, size, startInfo, stopInfo, swapIterator, swapKeys, swapSize, toMap, transformAll, transformAllAsync, transformAsync, tx, txStart, txStart, txStart, txStartAffinity, txStartPartition, txSynchronizations, txSynchronize, txUnsynchronize, unlock, values, values, wrappers, writeExternaladdMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMetaequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMetapublic static final GridProductVersion FORCE_TRANSFORM_BACKUP_SINCE
public GridDhtAtomicCache()
Externalizable.public GridDhtAtomicCache(GridCacheContext<K,V> ctx)
ctx - Cache context.public GridDhtAtomicCache(GridCacheContext<K,V> ctx, GridCacheConcurrentMap<K,V> map)
ctx - Cache context.map - Cache concurrent map.public boolean isDhtAtomic()
isDhtAtomic in class GridCacheAdapter<K,V>True if cache is DHT Atomic.protected void init()
init in class GridDhtCacheAdapter<K,V>public void start()
throws GridException
start in class GridCacheAdapter<K,V>GridException - If start failed.public void resetMetrics()
resetMetrics in interface GridCache<K,V>resetMetrics in class GridCacheAdapter<K,V>public void near(GridNearAtomicCache<K,V> near)
near - Near cache.public GridNearCacheAdapter<K,V> near()
near in class GridDhtCacheAdapter<K,V>public GridCacheEntry<K,V> entry(K key)
Note that this method can return null if projection is configured as
pre-filtered and entry key and value don't pass key-value filter of the projection.
entry in interface GridCacheProjection<K,V>entry in class GridDhtCacheAdapter<K,V>key - Entry key.null if projection pre-filtering was not passed.public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws GridException
non-null value is found, it will be immediately returned.
Note that if modes are not provided this method works exactly the same way as
GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.
peek in interface GridCacheProjection<K,V>peek in class GridCacheAdapter<K,V>key - Entry key.modes - Optional set of peek modes.GridException - If peek operation failed.public GridCacheTxLocalAdapter<K,V> newTx(boolean implicit, boolean implicitSingle, GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, boolean syncCommit, boolean syncRollback, boolean swapOrOffheapEnabled, boolean storeEnabled, int txSize, @Nullable Object grpLockKey, boolean partLock)
newTx in class GridDhtCacheAdapter<K,V>implicit - True if transaction is implicit.implicitSingle - Implicit-with-single-key flag.concurrency - Concurrency.isolation - Isolation.timeout - transaction timeout.invalidate - Invalidation flag.syncCommit - Synchronous commit flag.syncRollback - Synchronous rollback flag.swapOrOffheapEnabled - If true then swap storage will be used.storeEnabled - if true then read/write through will be used.txSize - Expected transaction size.grpLockKey - Group lock key if this is a group-lock transaction.partLock - True if partition is locked.public GridFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable GridCacheEntryEx<K,V> entry, @Nullable UUID subjId, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter)
GridDhtCacheAdapter.getDhtAsync(UUID, long, LinkedHashMap, boolean, long, UUID, GridPredicate[])
method instead to retrieve DHT value.getAllAsync in class GridDhtCacheAdapter<K,V>keys - forcePrimary - skipTx - filter - public V put(K key, V val, @Nullable GridCacheEntryEx<K,V> cached, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
GridCacheEntryImpl.put in interface GridCacheProjectionEx<K,V>put in class GridCacheAdapter<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.GridException - If failed.public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K,V> cached, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.putx in interface GridCacheProjectionEx<K,V>putx in class GridCacheAdapter<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.GridException - If failed.public boolean putx(K key, V val, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.put(Object, Object, GridPredicate[]) method, it does not return previous
value and, therefore, does not have any overhead associated with returning a value. It
should be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putx in interface GridCacheProjection<K,V>putx in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.True if optional filter passed and value was stored in cache,
false otherwise. Note that this method will return true if filter is not
specified.GridException - If put operation failed.public GridFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K,V> entry, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.putAsync in interface GridCacheProjectionEx<K,V>putAsync in class GridCacheAdapter<K,V>key - Key.val - Value.entry - Optional cached entry.ttl - Optional time-to-live value. If negative, leaves ttl value unchanged.filter - Optional filter.public GridFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K,V> entry, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.putxAsync in interface GridCacheProjectionEx<K,V>putxAsync in class GridCacheAdapter<K,V>key - Key.val - Value.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leave ttl value unchanged.filter - Optional filter.public V putIfAbsent(K key, V val) throws GridException
GridCacheMode.PARTITIONED or GridCacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.putxIfAbsent(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putIfAbsent in interface GridCacheProjection<K,V>putIfAbsent in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.GridException - If put operation failed.public GridFuture<V> putIfAbsentAsync(K key, V val)
GridCacheMode.PARTITIONED or GridCacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.putxIfAbsentAsync(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putIfAbsentAsync in interface GridCacheProjection<K,V>putIfAbsentAsync in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean putxIfAbsent(K key, V val) throws GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putxIfAbsent in interface GridCacheProjection<K,V>putxIfAbsent in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.true if value is stored in cache and false otherwise.GridException - If put operation failed.public GridFuture<Boolean> putxIfAbsentAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putxIfAbsentAsync in interface GridCacheProjection<K,V>putxIfAbsentAsync in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.public V replace(K key, V val) throws GridException
GridCacheMode.PARTITIONED or GridCacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.replacex(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replace in interface GridCacheProjection<K,V>replace in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.GridException - If replace operation failed.public GridFuture<V> replaceAsync(K key, V val)
GridCacheMode.PARTITIONED caches, the value will be loaded from the primary node,
which in its turn may load the value from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.replacex(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replaceAsync in interface GridCacheProjection<K,V>replaceAsync in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean replacex(K key, V val) throws GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.replace(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacex in interface GridCacheProjection<K,V>replacex in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.True if replace happened, false otherwise.GridException - If replace operation failed.public GridFuture<Boolean> replacexAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.replaceAsync(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacexAsync in interface GridCacheProjection<K,V>replacexAsync in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean replace(K key, V oldVal, V newVal) throws GridException
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replace in interface GridCacheProjection<K,V>replace in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.True if replace happened, false otherwise.GridException - If replace operation failed.public GridFuture<Boolean> replaceAsync(K key, V oldVal, V newVal)
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replaceAsync in interface GridCacheProjection<K,V>replaceAsync in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.public GridCacheReturn<V> removex(K key, V val) throws GridException
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removex in interface GridCacheProjectionEx<K,V>removex in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.GridException - If remove failed.public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws GridException
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacex in interface GridCacheProjectionEx<K,V>replacex in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.GridException - If replace operation failed.public GridFuture<GridCacheReturn<V>> removexAsync(K key, V val)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removexAsync in interface GridCacheProjectionEx<K,V>removexAsync in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.public GridFuture<GridCacheReturn<V>> replacexAsync(K key, V oldVal, V newVal)
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacexAsync in interface GridCacheProjectionEx<K,V>replacexAsync in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.public void putAll(Map<? extends K,? extends V> m, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
If write-through is enabled, the stored values will be persisted to GridCacheStore
via GridCacheStore.putAll(GridCacheTx, Map) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putAll in interface GridCacheProjection<K,V>putAll in class GridCacheAdapter<K,V>m - Key-value pairs to store in cache.filter - Optional entry filter. If provided, then entry will
be stored only if the filter returned true.GridException - If put operation failed.public GridFuture<?> putAllAsync(Map<? extends K,? extends V> m, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter)
If write-through is enabled, the stored values will be persisted to GridCacheStore
via GridCacheStore.putAll(GridCacheTx, Map) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putAllAsync in interface GridCacheProjection<K,V>putAllAsync in class GridCacheAdapter<K,V>m - Key-value pairs to store in cache.filter - Optional entry filter. If provided, then entry will
be stored only if the filter returned true.public void putAllDr(Map<? extends K,GridCacheDrInfo<V>> drMap) throws GridException
putAllDr in interface GridCacheProjectionEx<K,V>putAllDr in class GridCacheAdapter<K,V>drMap - DR map.GridException - If put operation failed.public GridFuture<?> putAllDrAsync(Map<? extends K,GridCacheDrInfo<V>> drMap)
putAllDrAsync in interface GridCacheProjectionEx<K,V>putAllDrAsync in class GridCacheAdapter<K,V>drMap - DR map.public void transform(K key, GridClosure<V,V> transformer) throws GridException
valTransform closure to the previous value associated with
given key in cache. Result of closure application is guaranteed to be atomic, however, closure
itself can be applied more than once.
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putx(Object, Object, GridPredicate[]) or GridCacheProjection.put(Object, Object, GridPredicate[])
methods, this method will not transfer the whole updated value over the network, but instead will
transfer the transforming closure that will be applied on each remote node involved in transaction.
It may add significant performance gain when dealing with large values as the value is much larger
than the closure itself. If write-through is enabled, the stored value will be persisted to
GridCacheStore via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transform in interface GridCacheProjection<K,V>transform in class GridCacheAdapter<K,V>key - Key to store in cache.transformer - Closure to be applied to the previous value in cache. If this closure returns
null, the associated value will be removed from cache.GridException - On any error occurred while storing value in cache.public <R> R transformAndCompute(K key, GridClosure<V,GridBiTuple<V,R>> transformer) throws GridException
transformer closure to the previous value associated with given key in cache,
closure should return GridBiTuple instance where first value is new value stored in cache
and second value is returned as result of this method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAndCompute in interface GridCacheProjection<K,V>transformAndCompute in class GridCacheAdapter<K,V>key - Key to store in cache.transformer - Closure to be applied to the previous value in cache.GridException - On any error occurred while storing value in cache.public GridFuture<?> transformAsync(K key, GridClosure<V,V> transformer, @Nullable GridCacheEntryEx<K,V> entry, long ttl)
GridCacheEntryImpl.transformAsync in interface GridCacheProjectionEx<K,V>transformAsync in class GridCacheAdapter<K,V>key - Key.transformer - Transformer closure.entry - Cached entry.ttl - Optional time-to-lve.public void transformAll(@Nullable Map<? extends K,? extends GridClosure<V,V>> m) throws GridException
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putAll(Map, GridPredicate[]) method, this method will not transfer
the whole updated value over the network, but instead will transfer the transforming closures
that will be applied on each remote node involved in transaction. It may add significant
performance gain when dealing with large values as the value is much larger than the closure itself.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAll in interface GridCacheProjection<K,V>transformAll in class GridCacheAdapter<K,V>m - Map containing keys and closures to be applied to values.GridException - On any error occurred while storing value in cache.public GridFuture<?> transformAllAsync(@Nullable Map<? extends K,? extends GridClosure<V,V>> m)
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putAll(Map, GridPredicate[]) method, this method will not transfer
the whole updated value over the network, but instead will transfer the transforming closures
that will be applied on each remote node involved in transaction. It may add significant performance
gain when dealing with large values as the value is much larger than the closure itself.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAllAsync in interface GridCacheProjection<K,V>transformAllAsync in class GridCacheAdapter<K,V>m - Map containing keys and closures to be applied to values.public V remove(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.remove in interface GridCacheProjectionEx<K,V>remove in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.GridException - If failed.public GridFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.removeAsync in interface GridCacheProjectionEx<K,V>removeAsync in class GridCacheAdapter<K,V>key - Key to remove.entry - Optional cached entry.filter - Optional filter.public void removeAll(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAll in interface GridCacheProjection<K,V>removeAll in class GridCacheAdapter<K,V>keys - Keys whose mappings are to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.GridException - If remove failed.public GridFuture<?> removeAllAsync(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>>[] filter)
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAllAsync in interface GridCacheProjection<K,V>removeAllAsync in class GridCacheAdapter<K,V>keys - Keys whose mappings are to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.public boolean removex(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.removex in interface GridCacheProjectionEx<K,V>removex in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.GridException - If failed.public GridFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.removexAsync in interface GridCacheProjectionEx<K,V>removexAsync in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.public boolean remove(K key, V val) throws GridException
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.remove in interface GridCacheProjection<K,V>remove in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.True if entry was removed and passed in value matched the cached one,
false otherwise.GridException - If remove failed.public GridFuture<Boolean> removeAsync(K key, V val)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAsync in interface GridCacheProjection<K,V>removeAsync in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.true
if currently cached value will match the passed in one.public void removeAll(GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
null, then all entries in cache will be enrolled
into transaction.
USE WITH CARE - if your cache has many entries that pass through the filter or if filter is empty, then transaction will quickly become very heavy and slow. Also, locks are acquired in undefined order, so it may cause a deadlock when used with other concurrent transactional updates.
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAll in interface GridCacheProjection<K,V>removeAll in class GridCacheAdapter<K,V>filter - Filter used to supply keys for remove operation (if null,
then nothing will be removed).GridException - If remove failed.public GridFuture<?> removeAllAsync(GridPredicate<GridCacheEntry<K,V>>[] filter)
null, then all entries in cache will be enrolled
into transaction.
USE WITH CARE - if your cache has many entries that pass through the filter or if filter is empty, then transaction will quickly become very heavy and slow.
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAllAsync in interface GridCacheProjection<K,V>removeAllAsync in class GridCacheAdapter<K,V>filter - Filter used to supply keys for remove operation (if null,
then nothing will be removed).public void removeAllDr(Map<? extends K,GridCacheVersion> drMap) throws GridException
removeAllDr in interface GridCacheProjectionEx<K,V>removeAllDr in class GridCacheAdapter<K,V>drMap - DR map.GridException - If remove failed.public GridFuture<?> removeAllDrAsync(Map<? extends K,GridCacheVersion> drMap)
removeAllDrAsync in interface GridCacheProjectionEx<K,V>removeAllDrAsync in class GridCacheAdapter<K,V>drMap - DR map.protected <T> GridFuture<T> asyncOp(CO<GridFuture<T>> op)
op - Operation closure.protected GridFuture<Boolean> lockAllAsync(Collection<? extends K> keys, long timeout, @Nullable GridCacheTxLocalEx<K,V> tx, boolean isInvalidate, boolean isRead, boolean retval, @Nullable GridCacheTxIsolation isolation, GridPredicate<GridCacheEntry<K,V>>[] filter)
lockAllAsync in class GridDistributedCacheAdapter<K,V>keys - Keys to lock.timeout - Timeout.tx - TransactionisInvalidate - Invalidation flag.isRead - Indicates whether value is read or written.retval - Flag to return value.isolation - Transaction isolation.filter - Optional filter.public void updateAllAsyncInternal(UUID nodeId, GridNearAtomicUpdateRequest<K,V> req, @Nullable GridCacheEntryEx<K,V> cached, CI2<GridNearAtomicUpdateRequest<K,V>,GridNearAtomicUpdateResponse<K,V>> completionCb)
nodeId - Node ID.req - Update request.cached - Cached entry if updating single local entry.completionCb - Completion callback.public void updateAllAsyncInternal0(UUID nodeId, GridNearAtomicUpdateRequest<K,V> req, @Nullable GridCacheEntryEx<K,V> cached, CI2<GridNearAtomicUpdateRequest<K,V>,GridNearAtomicUpdateResponse<K,V>> completionCb)
nodeId - Node ID.req - Update request.cached - Cached entry if updating single local entry.completionCb - Completion callback.public String toString()
toString in class GridDhtCacheAdapter<K,V>Copyright © 2014. All rights reserved.