public abstract class GridDhtCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.PeekModes, 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.
|
cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, DFLT_START_CACHE_SIZE, keyCheck, lastFut, locNodeId, log, map, MAX_RETRIES, metrics, RET2NULL, txLockMsgLog
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) |
GridDhtCacheEntry |
entryExx(KeyCacheObject key) |
GridDhtCacheEntry |
entryExx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
protected GridCacheMapEntryFactory |
entryFactory() |
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,
UUID subjId,
String taskName,
boolean deserializeBinary,
boolean recovery,
boolean skipVals,
boolean canRemap,
boolean needVer)
This method is used internally.
|
GridDhtFuture<Collection<GridCacheEntryInfo>> |
getDhtAsync(UUID reader,
long msgId,
Map<KeyCacheObject,Boolean> keys,
boolean readThrough,
AffinityTopologyVersion topVer,
UUID subjId,
int taskNameHash,
IgniteCacheExpiryPolicy expiry,
boolean skipVals,
boolean recovery) |
protected void |
init()
Post constructor initialization for subclasses.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
localEntriesIterator(boolean primary,
boolean backup,
boolean keepBinary) |
Iterator<javax.cache.Cache.Entry<K,V>> |
localEntriesIterator(boolean primary,
boolean backup,
boolean keepBinary,
AffinityTopologyVersion topVer) |
Iterator<? extends GridCacheEntryEx> |
localEntriesIteratorEx(boolean primary,
boolean backup,
AffinityTopologyVersion topVer) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc,
boolean keepBinary) |
void |
localLoadCache(IgniteBiPredicate<K,V> p,
Object[] args)
Delegates to
CacheStore.loadCache(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.
|
void |
onReconnected() |
GridDhtCacheEntry |
peekExx(KeyCacheObject key) |
GridCachePreloader |
preloader() |
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
long |
primarySizeLong()
Gets the number of all primary entries cached on this node as a long value.
|
void |
printMemoryStats()
Prints memory stats.
|
protected void |
processNearGetRequest(UUID nodeId,
GridNearGetRequest req) |
protected void |
processNearGetResponse(UUID nodeId,
GridNearGetResponse res) |
protected void |
processNearSingleGetRequest(UUID nodeId,
GridNearSingleGetRequest req) |
protected void |
processNearSingleGetResponse(UUID nodeId,
GridNearSingleGetResponse res) |
void |
sendTtlUpdateRequest(IgniteCacheExpiryPolicy expiryPlc) |
int |
size()
Gets the number of all entries cached on this node.
|
long |
sizeLong()
Gets the number of all entries cached on this node as a long value.
|
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally(boolean srv,
boolean near,
boolean readers)
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.
|
localSizeLong, localSizeLong, lockAllAsync, lockAllAsync, removeAll, removeAllAsync, removeVersionedEntry, txLockAsync
affinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, checkJta, clear, clear, clearAll, clearAllAsync, clearAsync, clearAsync, clearLocally, clearLocally, clearLocally, clearLocallyAll, clusterMetrics, clusterMetrics, clusterMxBean, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, decrementSize, entries, entryEx, entryEx, entrySet, entrySet, entrySetx, evict, evictAll, expiry, expiryPolicy, forceKeyCheck, forSubjectId, get, get, get0, getAll, getAll0, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPut0, getAndPutAsync, getAndPutAsync, getAndPutAsync0, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemove0, getAndRemoveAsync, getAndRemoveAsync0, getAndReplace, getAndReplaceAsync, getAsync, getAsync, getAsync, getEntries, getEntriesAsync, getEntry, getEntryAsync, getForcePrimary, getForcePrimaryAsync, getTopologySafe, igfsDataSpaceUsed, igniteIterator, igniteIterator, incrementSize, invoke, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isIgfsDataCache, isLocal, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, iterator, keepBinary, keySet, keySetx, loadAll, localEntries, localLoadCacheAsync, localMetrics, localMxBean, localPeek, localSize, lock, lockAll, lockAsync, log, lostPartitions, map, metrics0, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, onIgfsDataSizeChanged, onUndeploy, parsePeekModes, peekEx, peekEx, primaryKeySet, put, put, put0, putAll, putAll0, putAllAsync, putAllAsync0, putAllConflict, putAllConflictAsync, putAsync, putAsync, putAsync0, putIfAbsent, putIfAbsentAsync, readExternal, readResolve, rebalance, remove, remove, remove, remove0, removeAll, removeAll0, removeAllAsync, removeAllAsync0, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeAsync0, removeEntry, removeIfObsolete, replace, replace, replaceAsync, replaceAsync, saveFuture, scanIterator, setSkipStore, size, sizeAsync, sizeLong, sizeLong, sizeLongAsync, sizeLongAsync, skipStore, startInfo, stopInfo, tx, txStart, txStart, txStartEx, unlock, validateCacheKey, validateCacheKeys, values, values, withExpiryPolicy, withNoRetries, writeExternal
protected 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 final void processNearGetResponse(UUID nodeId, GridNearGetResponse res)
nodeId
- Sender node ID.res
- Near get response.protected void processNearSingleGetResponse(UUID nodeId, GridNearSingleGetResponse res)
nodeId
- Sender node ID.res
- Near get response.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 onReconnected()
onReconnected
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>
protected GridCacheMapEntryFactory entryFactory()
entryFactory
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, 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.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, boolean keepBinary) 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(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(IgniteBiInClosure, Object...)
method.IgniteCheckedException
- If loading failed.public int size()
IgniteInternalCache
. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size()
.
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
size
in interface IgniteInternalCache<K,V>
size
in class GridCacheAdapter<K,V>
public long sizeLong()
IgniteInternalCache
. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size()
.
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
sizeLong
in interface IgniteInternalCache<K,V>
sizeLong
in class GridCacheAdapter<K,V>
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 long primarySizeLong()
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.
primarySizeLong
in interface IgniteInternalCache<K,V>
primarySizeLong
in class GridCacheAdapter<K,V>
public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, boolean skipVals, boolean canRemap, boolean needVer)
getDhtAsync(UUID, long, Map, boolean, AffinityTopologyVersion, UUID, int, IgniteCacheExpiryPolicy, boolean, boolean)
method instead to retrieve DHT value.getAllAsync
in class GridCacheAdapter<K,V>
keys
- Keys.forcePrimary
- Force primary.skipTx
- Skip tx.needVer
- Need version. @return Need version.subjId
- Subj Id.taskName
- Task name.deserializeBinary
- Deserialize binary.recovery
- Recovery mode flag.skipVals
- Skip values.canRemap
- Can remap flag.GridCacheAdapter.getAllAsync(Collection)
public GridDhtFuture<Collection<GridCacheEntryInfo>> getDhtAsync(UUID reader, long msgId, Map<KeyCacheObject,Boolean> keys, boolean readThrough, AffinityTopologyVersion topVer, @Nullable UUID subjId, int taskNameHash, @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals, boolean recovery)
reader
- Reader node ID.msgId
- Message ID.keys
- Keys to get.readThrough
- Read through flag.topVer
- Topology version.subjId
- Subject ID.taskNameHash
- Task name hash code.expiry
- Expiry policy.skipVals
- Skip values flag.protected void processNearSingleGetRequest(UUID nodeId, GridNearSingleGetRequest req)
nodeId
- Node ID.req
- Get request.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(boolean srv, boolean near, boolean readers)
splitClearLocally
in class GridCacheAdapter<K,V>
srv
- Whether to clear server cache.near
- Whether to clear near cache.readers
- Whether to clear readers.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.public Iterator<javax.cache.Cache.Entry<K,V>> localEntriesIterator(boolean primary, boolean backup, boolean keepBinary)
primary
- If true
includes primary entries.backup
- If true
includes backup entries.keepBinary
- Keep binary flag.public Iterator<javax.cache.Cache.Entry<K,V>> localEntriesIterator(boolean primary, boolean backup, boolean keepBinary, AffinityTopologyVersion topVer)
primary
- If true
includes primary entries.backup
- If true
includes backup entries.keepBinary
- Keep binary flag.topVer
- Specified affinity topology version.public Iterator<? extends GridCacheEntryEx> localEntriesIteratorEx(boolean primary, boolean backup, AffinityTopologyVersion topVer)
primary
- If true
includes primary entries.backup
- If true
includes backup entries.topVer
- Specified affinity topology version.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017