public abstract class GridDhtCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
GridDhtCacheAdapter.GridSubjectIdAddedMessageConverter616
GridDhtAtomicUpdateRequest converter for version 6.1.2
|
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.FutureHolder| Modifier and Type | Field and Description |
|---|---|
protected GridCachePreloader<K,V> |
preldr
Preloader.
|
static GridProductVersion |
SUBJECT_ID_EVENTS_SINCE_VER |
afterPessimisticUnlock, beforePessimisticLock, cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, gridCfg, lastFut, locNodeId, log, map, metrics| Modifier | Constructor and Description |
|---|---|
protected |
GridDhtCacheAdapter()
Empty constructor required for
Externalizable. |
protected |
GridDhtCacheAdapter(GridCacheContext<K,V> ctx) |
protected |
GridDhtCacheAdapter(GridCacheContext<K,V> ctx,
GridCacheConcurrentMap<K,V> map)
Constructor used for near-only cache.
|
| Modifier and Type | Method and Description |
|---|---|
long |
beginMultiUpdate()
Starts multi-update lock.
|
GridDhtPreloader<K,V> |
dhtPreloader() |
void |
endMultiUpdate()
Ends multi-update lock.
|
GridCacheEntry<K,V> |
entry(K key)
Gets entry from cache with the specified key.
|
GridCacheEntryEx<K,V> |
entryEx(K key,
boolean touch) |
GridCacheEntryEx<K,V> |
entryEx(K key,
long topVer) |
GridDhtCacheEntry<K,V> |
entryExx(K key) |
GridDhtCacheEntry<K,V> |
entryExx(K key,
long topVer) |
GridCacheEntryEx<K,V> |
entryExx(K key,
long topVer,
boolean allowDetached,
boolean touch)
Gets or creates entry for given key.
|
Set<GridCacheEntry<K,V>> |
entrySet(int part)
Gets set containing cache entries that belong to provided partition or
null
if partition not found locally. |
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.
|
GridDhtFuture<Collection<GridCacheEntryInfo<K,V>>> |
getDhtAsync(UUID reader,
long msgId,
LinkedHashMap<? extends K,Boolean> keys,
boolean reload,
long topVer,
UUID subjId,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
protected void |
init()
Post constructor initialization for subclasses.
|
void |
loadCache(GridBiPredicate<K,V> p,
long ttl,
Object[] args)
Delegates to
GridCacheStore.loadCache(GridBiInClosure,Object...) method
to load state from the underlying persistent storage. |
GridFuture<?> |
multiUpdateFinishFuture(long topVer)
Creates multi update finish future.
|
GridDhtTopologyFuture |
multiUpdateTopologyFuture() |
abstract GridNearCacheAdapter<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) |
void |
onDeferredDelete(GridCacheEntryEx<K,V> entry,
GridCacheVersion ver) |
void |
onKernalStart()
Kernal start callback.
|
void |
onKernalStop()
Kernal stop callback.
|
GridDhtCacheEntry<K,V> |
peekExx(K key) |
GridCachePreloader<K,V> |
preloader() |
int |
primarySize()
Gets size of all primary keys for this cache.
|
void |
printMemoryStats()
Prints memory stats.
|
protected void |
processNearGetRequest(UUID nodeId,
GridNearGetRequest<K,V> req) |
V |
reload(K key,
GridPredicate<GridCacheEntry<K,V>>... filter) |
List<GridCacheClearAllRunnable<K,V>> |
splitClearAll()
Split clear all task into multiple runnables.
|
void |
stop()
Stops this cache.
|
GridDhtPartitionTopology<K,V> |
topology() |
String |
toString() |
void |
unlockAll(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Unlocks given keys only if current thread owns the locks.
|
lockAllAsync, lockAllAsync, 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, isDhtAtomic, 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, 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, put, putAll, putAllAsync, putAllDr, putAllDrAsync, putAsync, putAsync, putIfAbsent, putIfAbsentAsync, putx, putx, putxAsync, putxAsync, putxIfAbsent, putxIfAbsentAsync, queries, randomEntry, readExternal, readResolve, readThroughAllAsync, reload, reloadAll, reloadAll, reloadAll, reloadAll, reloadAll, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAsync, reloadAsync, remove, remove, remove, removeAll, removeAll, removeAllAsync, removeAllAsync, removeAllDr, removeAllDrAsync, removeAsync, removeAsync, removeAsync, removeEntry, removeIfObsolete, removex, removex, removex, removexAsync, removexAsync, removexAsync, replace, replace, replaceAsync, replaceAsync, replacex, replacex, replacexAsync, replacexAsync, resetMetrics, saveFuture, size, start, startInfo, stopInfo, swapIterator, swapKeys, swapSize, toMap, transform, transformAll, transformAll, transformAllAsync, transformAllAsync, transformAndCompute, transformAsync, 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 SUBJECT_ID_EVENTS_SINCE_VER
protected GridCachePreloader<K,V> preldr
protected GridDhtCacheAdapter()
Externalizable.protected GridDhtCacheAdapter(GridCacheContext<K,V> ctx)
ctx - Context.protected GridDhtCacheAdapter(GridCacheContext<K,V> ctx, GridCacheConcurrentMap<K,V> map)
ctx - Cache context.map - Cache map.protected void init()
init in class GridCacheAdapter<K,V>public void stop()
stop in class GridCacheAdapter<K,V>public void onKernalStart()
throws GridException
onKernalStart in class GridCacheAdapter<K,V>GridException - If callback failed.public void onKernalStop()
onKernalStop in class GridCacheAdapter<K,V>public void printMemoryStats()
printMemoryStats in class GridCacheAdapter<K,V>public abstract GridNearCacheAdapter<K,V> near()
public GridDhtPartitionTopology<K,V> topology()
public GridCachePreloader<K,V> preloader()
preloader in class GridCacheAdapter<K,V>public GridDhtPreloader<K,V> dhtPreloader()
@Nullable public GridDhtTopologyFuture multiUpdateTopologyFuture()
public long beginMultiUpdate()
throws GridException
GridException - If failed.public void endMultiUpdate()
throws GridException
GridException - If failed.@Nullable public GridFuture<?> multiUpdateFinishFuture(long topVer)
null if no multi-update locks are found.topVer - Topology version.@Nullable public GridDhtCacheEntry<K,V> peekExx(K key)
key - Key.public GridCacheEntry<K,V> entry(K key) throws GridDhtInvalidPartitionException
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 GridCacheAdapter<K,V>key - Entry key.null if projection pre-filtering was not passed.GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridCacheEntryEx<K,V> entryEx(K key, boolean touch) throws GridDhtInvalidPartitionException
entryEx in class GridCacheAdapter<K,V>key - Entry key.touch - Whether created entry should be touched.null).GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridCacheEntryEx<K,V> entryEx(K key, long topVer) throws GridDhtInvalidPartitionException
entryEx in class GridCacheAdapter<K,V>key - Entry key.topVer - Topology version.null).GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridDhtCacheEntry<K,V> entryExx(K key) throws GridDhtInvalidPartitionException
key - Key.GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridDhtCacheEntry<K,V> entryExx(K key, long topVer) throws GridDhtInvalidPartitionException
key - Key.topVer - Topology version.GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridCacheEntryEx<K,V> entryExx(K key, long topVer, boolean allowDetached, boolean touch)
allowDetached is true, detached entry will be returned, otherwise exception will be
thrown.key - Key for which entry should be returned.allowDetached - Whether to allow detached entries.touch - True if entry should be passed to eviction policy.GridDhtInvalidPartitionException - if entry does not belong to this node and
allowDetached is false.public void loadCache(GridBiPredicate<K,V> p, long ttl, Object[] args) throws GridException
GridCacheStore.loadCache(GridBiInClosure,Object...) method
to load state from the underlying persistent storage. The loaded values
will then be given to the optionally passed in predicate, and, if the predicate returns
true, will be stored in cache. If predicate is null, then
all loaded values will be stored in cache.
Note that this method does not receive keys as a parameter, so it is up to
GridCacheStore implementation to provide all the data to be loaded.
This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.
loadCache in interface GridCache<K,V>loadCache in class GridCacheAdapter<K,V>p - Optional predicate (may be null). If provided, will be used to
filter values to be put into cache.ttl - Time to live for loaded entries (0 for infinity).args - Optional user arguments to be passed into
GridCacheStore.loadCache(GridBiInClosure, Object...) method.GridException - If loading failed.public int primarySize()
GridCacheMode.LOCAL mode,
this method is identical to GridCacheProjection.size().
For GridCacheMode.PARTITIONED and GridCacheMode.REPLICATED modes, this method will
return number of primary entries in the cache (excluding any backups). The complexity of this method
is O(P), where P is the total number of partitions.
primarySize in interface GridCacheProjection<K,V>primarySize in class GridCacheAdapter<K,V>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)
getDhtAsync(UUID, long, LinkedHashMap, boolean, long, UUID, GridPredicate[])
method instead to retrieve DHT value.getAllAsync in class GridCacheAdapter<K,V>keys - forcePrimary - skipTx - filter - public V reload(K key, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
reload in class GridCacheAdapter<K,V>key - Key.filter - Filter to evaluate.GridException - If failed.public GridDhtFuture<Collection<GridCacheEntryInfo<K,V>>> getDhtAsync(UUID reader, long msgId, LinkedHashMap<? extends K,Boolean> keys, boolean reload, long topVer, @Nullable UUID subjId, GridPredicate<GridCacheEntry<K,V>>[] filter)
reader - Reader node ID.msgId - Message ID.keys - Keys to get.reload - Reload flag.topVer - Topology version.filter - Optional filter.protected void processNearGetRequest(UUID nodeId, GridNearGetRequest<K,V> req)
nodeId - Node ID.req - Get request.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 GridCacheAdapter<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 void unlockAll(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>>[] filter)
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.keys - Keys to unlock.filter - Optional filter which needs to pass for individual entries
to be unlocked.public Set<GridCacheEntry<K,V>> entrySet(int part)
null
if partition not found locally.entrySet in interface GridCacheProjection<K,V>entrySet in class GridCacheAdapter<K,V>part - Partition.null if partition
not found locally.public String toString()
toString in class GridDistributedCacheAdapter<K,V>public List<GridCacheClearAllRunnable<K,V>> splitClearAll()
splitClearAll in class GridCacheAdapter<K,V>public void onDeferredDelete(GridCacheEntryEx<K,V> entry, GridCacheVersion ver)
onDeferredDelete in class GridCacheAdapter<K,V>entry - Entry.ver - Version.Copyright © 2014. All rights reserved.