public abstract class GridDhtCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>| Modifier and Type | Field and Description |
|---|---|
protected GridCachePreloader<K,V> |
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<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.
|
javax.cache.Cache.Entry<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<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<K,V> entry,
UUID subjId,
String taskName,
boolean deserializePortable,
boolean skipVals)
This method is used internally.
|
GridDhtFuture<Collection<GridCacheEntryInfo<K,V>>> |
getDhtAsync(UUID reader,
long msgId,
LinkedHashMap<? extends K,Boolean> keys,
boolean readThrough,
boolean reload,
long topVer,
UUID subjId,
int taskNameHash,
boolean deserializePortable,
IgniteCacheExpiryPolicy expiry,
boolean skipVals) |
protected void |
init()
Post constructor initialization for subclasses.
|
void |
loadCache(IgniteBiPredicate<K,V> p,
long ttl,
Object[] args)
Delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
Iterator<javax.cache.Cache.Entry<K,V>> |
localEntriesIterator(boolean primary,
boolean backup) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc) |
IgniteInternalFuture<?> |
multiUpdateFinishFuture(long topVer)
Creates multi update finish future.
|
GridDhtTopologyFuture |
multiUpdateTopologyFuture() |
abstract GridNearCacheAdapter<K,V> |
near() |
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 the number of all primary entries cached on this node.
|
void |
printMemoryStats()
Prints memory stats.
|
protected void |
processNearGetRequest(UUID nodeId,
GridNearGetRequest<K,V> req) |
V |
reload(K key)
Reloads a single key from persistent storage.
|
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<K,V> |
topology() |
String |
toString() |
void |
unlockAll(Collection<? extends K> keys,
IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
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, clearAsync, clearLocally, clearLocally, clearLocally, clearLocally0, clearLocally0, commitTxAsync, compact, compact, compactAll, compactAll, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, containsValue, context, entries, entryEx, entryExSafe, entrySet, entrySet, entrySet, entrySetx, evict, evict, evictAll, evictAll, evictAll, expiry, expiryPolicy, flags, flagsOff, flagsOn, forAll, forceRepartition, forEach, forSubjectId, get, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllOutTx, getAllOutTxAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, globalPrimarySize, globalSize, gridProjection, igfsDataSpaceMax, igfsDataSpaceUsed, igniteIterator, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isIgfsDataCache, isLocal, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, iterator, keepPortable, keepPortable0, keySet, keySet, loadAll, loadCacheAsync, localEntries, localPeek, localSize, lock, lockAll, lockAsync, log, map, metrics, metrics0, mxBean, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, offHeapIterator, onIgfsDataSizeChanged, onUndeploy, overflowSize, peek, peek, peek, peek0, peek0, peek0, peekAll, peekAll0, peekAll0, peekEx, predicate, primaryEntrySet, primaryEntrySet, primaryEntrySetx, primaryKeySet, primaryKeySet, primaryValues, primaryValues, projection, projection, projection, promote, promote, promoteAll, put, put, putAll, putAllAsync, putAllDr, putAllDrAsync, putAsync, putAsync, putIfAbsent, putIfAbsentAsync, putx, putx, putxAsync, putxAsync, putxIfAbsent, putxIfAbsentAsync, queries, randomEntry, readExternal, readResolve, readThroughAllAsync, reloadAll, reloadAll, reloadAll, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAsync, remove, remove, remove, removeAll, removeAllAsync, removeAllAsync, removeAllDr, removeAllDrAsync, removeAsync, removeAsync, removeAsync, removeEntry, removeIfObsolete, removex, removex, removex, removexAsync, removexAsync, removexAsync, replace, replace, replaceAsync, replaceAsync, replacex, replacex, replacexAsync, replacexAsync, saveFuture, size, size, sizeAsync, startInfo, stopInfo, swapIterator, swapKeys, swapSize, toMap, tx, txStart, txStart, txStart, txStartEx, txSynchronizations, txSynchronize, txUnsynchronize, unlock, validateCacheKey, validateCacheKeys, values, values, withExpiryPolicy, writeExternalprotected 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 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<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 IgniteCheckedException
IgniteCheckedException - If failed.public void endMultiUpdate()
throws IgniteCheckedException
IgniteCheckedException - If failed.@Nullable public IgniteInternalFuture<?> 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 javax.cache.Cache.Entry<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 CacheProjection<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 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 loadCache(IgniteBiPredicate<K,V> p, long ttl, 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.
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
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 CacheProjection.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 CacheProjection<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<K,V> entry, @Nullable UUID subjId, String taskName, boolean deserializePortable, boolean skipVals)
getDhtAsync(UUID, long, LinkedHashMap, boolean, boolean, long, UUID, int, boolean, IgniteCacheExpiryPolicy, boolean)
method instead to retrieve DHT value.getAllAsync in class GridCacheAdapter<K,V>keys - forcePrimary - skipTx - public V reload(K key) throws IgniteCheckedException
CacheStore#load(Transaction, Object)
method.
reload in interface CacheProjection<K,V>reload in class GridCacheAdapter<K,V>key - Key.IgniteCheckedException - If failed.public GridDhtFuture<Collection<GridCacheEntryInfo<K,V>>> getDhtAsync(UUID reader, long msgId, LinkedHashMap<? extends K,Boolean> keys, boolean readThrough, boolean reload, long topVer, @Nullable UUID subjId, int taskNameHash, boolean deserializePortable, @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.deserializePortable - Deserialize portable flag.expiry - Expiry policy.protected void processNearGetRequest(UUID nodeId, GridNearGetRequest<K,V> req)
nodeId - Node ID.req - Get request.public void sendTtlUpdateRequest(@Nullable IgniteCacheExpiryPolicy expiryPlc)
expiryPlc - Expiry policy.public void unlockAll(Collection<? extends K> keys, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter)
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.keys - Keys to unlock.filter - Optional filter which needs to pass for individual entries
to be unlocked.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 CacheProjection<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<K,V> entry, GridCacheVersion ver)
onDeferredDelete in class GridCacheAdapter<K,V>entry - Entry.ver - Version.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015