public abstract class GridDhtCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.TopologyVersionAwareJob, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>| Modifier and Type | Field and Description |
|---|---|
protected GridCachePreloader |
preldr
Preloader.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GridDhtCacheAdapter()
Empty constructor required for
Externalizable. |
protected |
GridDhtCacheAdapter(GridCacheContext<K,V> ctx) |
protected |
GridDhtCacheAdapter(GridCacheContext<K,V> ctx,
GridCacheConcurrentMap map)
Constructor used for near-only cache.
|
| Modifier and Type | Method and Description |
|---|---|
AffinityTopologyVersion |
beginMultiUpdate()
Starts multi-update lock.
|
protected GridDistributedCacheEntry |
createEntry(KeyCacheObject key) |
GridDhtPreloader |
dhtPreloader() |
void |
endMultiUpdate()
Ends multi-update lock.
|
GridCacheEntryEx |
entryEx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
GridCacheEntryEx |
entryEx(KeyCacheObject key,
boolean touch) |
GridDhtCacheEntry |
entryExx(KeyCacheObject key) |
GridDhtCacheEntry |
entryExx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
GridCacheEntryEx |
entryExx(KeyCacheObject key,
AffinityTopologyVersion topVer,
boolean allowDetached,
boolean touch)
Gets or creates entry for given key.
|
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(int part)
Gets set containing cache entries that belong to provided partition or
null
if partition is not found locally. |
IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
GridCacheEntryEx entry,
UUID subjId,
String taskName,
boolean deserializePortable,
boolean skipVals)
This method is used internally.
|
GridDhtFuture<Collection<GridCacheEntryInfo>> |
getDhtAsync(UUID reader,
long msgId,
LinkedHashMap<KeyCacheObject,Boolean> keys,
boolean readThrough,
boolean reload,
AffinityTopologyVersion topVer,
UUID subjId,
int taskNameHash,
IgniteCacheExpiryPolicy expiry,
boolean skipVals) |
protected void |
init()
Post constructor initialization for subclasses.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
localEntriesIterator(boolean primary,
boolean backup) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc) |
void |
localLoadCache(IgniteBiPredicate<K,V> p,
Object[] args)
Delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
IgniteInternalFuture<?> |
multiUpdateFinishFuture(AffinityTopologyVersion topVer)
Creates multi update finish future.
|
GridDhtTopologyFuture |
multiUpdateTopologyFuture() |
abstract GridNearCacheAdapter<K,V> |
near() |
protected boolean |
needRemap(AffinityTopologyVersion expVer,
AffinityTopologyVersion curVer) |
void |
onDeferredDelete(GridCacheEntryEx entry,
GridCacheVersion ver) |
void |
onKernalStart()
Kernal start callback.
|
void |
onKernalStop()
Kernal stop callback.
|
GridDhtCacheEntry |
peekExx(KeyCacheObject key) |
GridCachePreloader |
preloader() |
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
void |
printMemoryStats()
Prints memory stats.
|
protected void |
processNearGetRequest(UUID nodeId,
GridNearGetRequest req) |
void |
sendTtlUpdateRequest(IgniteCacheExpiryPolicy expiryPlc) |
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally()
Split clearLocally all task into multiple runnables.
|
void |
start()
Starts this cache.
|
void |
stop()
Stops this cache.
|
GridDhtPartitionTopology |
topology() |
String |
toString() |
void |
unlockAll(Collection<? extends K> keys)
Unlocks given keys only if current thread owns the locks.
|
lockAllAsync, lockAllAsync, removeAll, removeAllAsync, removeVersionedEntry, txLockAsyncaffinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, checkJta, clear, clear, clearAll, clearAsync, clearAsync, clearAsync, clearLocally, clearLocally, clearLocally, clearLocally0, clearLocally0, clearLocallyAll, commitTxAsync, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, entries, entryEx, entryEx, entryExSafe, entrySet, entrySet, entrySetx, evict, evictAll, expiry, expiryPolicy, forSubjectId, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPutAsync, getAndPutAsync, getAndPutAsync0, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemoveAsync, getAndReplace, getAndReplaceAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, igfsDataSpaceMax, igfsDataSpaceUsed, igniteIterator, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isIgfsDataCache, isLocal, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, iterator, keepPortable, keySet, keySet, keySetx, keySetx, loadAll, localEntries, localLoadCacheAsync, localPeek, localRemoveAll, localSize, lock, lockAll, lockAsync, log, map, metrics, metrics0, mxBean, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, onIgfsDataSizeChanged, onUndeploy, overflowSize, peekEx, peekEx, primaryEntrySet, primaryKeySet, primaryKeySet, promote, promoteAll, put, put, putAll, putAllAsync, putAllConflict, putAllConflictAsync, putAsync, putAsync, putAsync0, putIfAbsent, putIfAbsentAsync, randomEntry, readExternal, readResolve, readThroughAllAsync, rebalance, reloadAllAsync0, remove, remove, removeAll, removeAllAsync, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeEntry, removeIfObsolete, removex, removexAsync, replace, replace, replaceAsync, replaceAsync, replacex, replacexAsync, saveFuture, setSkipStore, size, size, sizeAsync, skipStore, startInfo, stopInfo, swapKeys, swapSize, tryPutIfAbsent, tx, txStart, txStart, txStartEx, unlock, validateCacheKey, validateCacheKeys, values, values, withExpiryPolicy, writeExternalprotected GridCachePreloader preldr
protected GridDhtCacheAdapter()
Externalizable.protected GridDhtCacheAdapter(GridCacheContext<K,V> ctx)
ctx - Context.protected GridDhtCacheAdapter(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)
ctx - Cache context.map - Cache map.protected void init()
init in class GridCacheAdapter<K,V>public void start()
throws IgniteCheckedException
start in class GridCacheAdapter<K,V>IgniteCheckedException - If start failed.public void stop()
stop in class GridCacheAdapter<K,V>public void onKernalStart()
throws IgniteCheckedException
onKernalStart in class GridCacheAdapter<K,V>IgniteCheckedException - 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 topology()
public GridCachePreloader preloader()
preloader in class GridCacheAdapter<K,V>public GridDhtPreloader dhtPreloader()
@Nullable public GridDhtTopologyFuture multiUpdateTopologyFuture()
public AffinityTopologyVersion beginMultiUpdate() throws IgniteCheckedException
IgniteCheckedException - If failed.public void endMultiUpdate()
throws IgniteCheckedException
IgniteCheckedException - If failed.@Nullable public IgniteInternalFuture<?> multiUpdateFinishFuture(AffinityTopologyVersion topVer)
null if no multi-update locks are found.topVer - Topology version.@Nullable public GridDhtCacheEntry peekExx(KeyCacheObject key)
key - Key.public GridCacheEntryEx entryEx(KeyCacheObject 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 entryEx(KeyCacheObject key, AffinityTopologyVersion 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 entryExx(KeyCacheObject key) throws GridDhtInvalidPartitionException
key - Key.GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridDhtCacheEntry entryExx(KeyCacheObject key, AffinityTopologyVersion topVer) throws GridDhtInvalidPartitionException
key - Key.topVer - Topology version.GridDhtInvalidPartitionException - If partition for the key is no longer valid.public GridCacheEntryEx entryExx(KeyCacheObject key, AffinityTopologyVersion 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.protected GridDistributedCacheEntry createEntry(KeyCacheObject key)
key - Key for which entry should be returned.public void localLoad(Collection<? extends K> keys, javax.cache.expiry.ExpiryPolicy plc) throws IgniteCheckedException
localLoad in class GridCacheAdapter<K,V>keys - Keys to load.plc - Optional expiry policy.IgniteCheckedException - If failed.public void localLoadCache(IgniteBiPredicate<K,V> p, Object[] args) throws IgniteCheckedException
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure,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
CacheStore 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.
localLoadCache in interface IgniteInternalCache<K,V>localLoadCache in class GridCacheAdapter<K,V>p - Optional predicate (may be null). If provided, will be used to
filter values to be put into cache.args - Optional user arguments to be passed into
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...) method.IgniteCheckedException - If loading failed.public int primarySize()
CacheMode.LOCAL non-distributed
cache mode, this method is identical to IgniteInternalCache.size().
For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will
return number of primary entries cached on this node (excluding any backups). The complexity of
this method is O(P), where P is the total number of partitions.
NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.
primarySize in interface IgniteInternalCache<K,V>primarySize in class GridCacheAdapter<K,V>public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable GridCacheEntryEx entry, @Nullable UUID subjId, String taskName, boolean deserializePortable, boolean skipVals)
getDhtAsync(UUID, long, LinkedHashMap, boolean, boolean, AffinityTopologyVersion, UUID, int, IgniteCacheExpiryPolicy, boolean)
method instead to retrieve DHT value.getAllAsync in class GridCacheAdapter<K,V>keys - Keys.forcePrimary - Force primary.skipTx - Skip tx.entry - Entry.subjId - Subj Id.taskName - Task name.deserializePortable - Deserialize portable.skipVals - Skip values.GridCacheAdapter.getAllAsync(Collection)public GridDhtFuture<Collection<GridCacheEntryInfo>> getDhtAsync(UUID reader, long msgId, LinkedHashMap<KeyCacheObject,Boolean> keys, boolean readThrough, boolean reload, AffinityTopologyVersion topVer, @Nullable UUID subjId, int taskNameHash, @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals)
reader - Reader node ID.msgId - Message ID.keys - Keys to get.readThrough - Read through flag.reload - Reload flag.topVer - Topology version.subjId - Subject ID.taskNameHash - Task name hash code.expiry - Expiry policy.protected void processNearGetRequest(UUID nodeId, GridNearGetRequest req)
nodeId - Node ID.req - Get request.public void sendTtlUpdateRequest(@Nullable IgniteCacheExpiryPolicy expiryPlc)
expiryPlc - Expiry policy.public void unlockAll(Collection<? extends K> keys)
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.keys - Keys to unlock.public Set<javax.cache.Cache.Entry<K,V>> entrySet(int part)
null
if partition is not found locally.
NOTE: this operation is not distributed and returns only the entries cached on this node.
entrySet in interface IgniteInternalCache<K,V>entrySet in class GridCacheAdapter<K,V>part - Partition.null if partition is
not found locally.public String toString()
toString in class GridDistributedCacheAdapter<K,V>public List<GridCacheClearAllRunnable<K,V>> splitClearLocally()
splitClearLocally in class GridCacheAdapter<K,V>public void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)
onDeferredDelete in class GridCacheAdapter<K,V>entry - Entry.ver - Version.protected final boolean needRemap(AffinityTopologyVersion expVer, AffinityTopologyVersion curVer)
expVer - Expected topology version.curVer - Current topology version.True if cache affinity changed and operation should be remapped.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.2.0-incubating Release Date : June 16 2015