public abstract class GridCacheAdapter<K,V> extends Object implements IgniteInternalCache<K,V>, Externalizable
Modifier and Type | Class and Description |
---|---|
protected class |
GridCacheAdapter.AsyncOp<T>
Cache operation.
|
protected static class |
GridCacheAdapter.BulkOperation |
protected static class |
GridCacheAdapter.CacheExpiryPolicy |
protected static class |
GridCacheAdapter.FutureHolder
Holder for last async operation future.
|
protected static class |
GridCacheAdapter.InvokeAllTimeStatClosure<T> |
protected static class |
GridCacheAdapter.PeekModes |
static class |
GridCacheAdapter.TopologyVersionAwareJob
Delayed callable class.
|
protected static class |
GridCacheAdapter.UpdateGetTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdatePutTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdateRemoveTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdateTimeStatClosure<T> |
Modifier and Type | Field and Description |
---|---|
protected CacheConfiguration |
cacheCfg
Cache configuration.
|
static int |
CLEAR_ALL_SPLIT_THRESHOLD
clearLocally() split threshold.
|
protected GridCacheContext<K,V> |
ctx
Cache configuration.
|
static int |
DFLT_CACHE_RETRIES_COUNT |
static int |
DFLT_CACHE_START_SIZE |
static int |
DFLT_START_CACHE_SIZE
Default cache start size.
|
protected ThreadLocal<GridCacheAdapter.FutureHolder> |
lastFut
Last asynchronous future.
|
protected UUID |
locNodeId
Local node ID.
|
protected IgniteLogger |
log
Logger.
|
protected GridCacheConcurrentMap |
map
Local map.
|
static int |
MAX_RETRIES
Maximum number of retries when topology changes.
|
protected CacheMetricsImpl |
metrics
Cache metrics.
|
protected static IgniteClosure |
RET2NULL
GridCacheReturn -to-null conversion. |
protected IgniteLogger |
txLockMsgLog
Logger.
|
Modifier | Constructor and Description |
---|---|
protected |
GridCacheAdapter()
Empty constructor required by
Externalizable . |
protected |
GridCacheAdapter(GridCacheContext<K,V> ctx) |
protected |
GridCacheAdapter(GridCacheContext<K,V> ctx,
@Nullable GridCacheConcurrentMap map) |
Modifier and Type | Method and Description |
---|---|
boolean |
active() |
void |
active(boolean active) |
Affinity<K> |
affinity()
Gets affinity service to provide information about data partitioning
and distribution.
|
Iterable<? extends GridCacheEntryEx> |
allEntries() |
protected <T> IgniteInternalFuture<T> |
asyncOp(GridNearTxLocal tx,
GridCacheAdapter.AsyncOp<T> op,
CacheOperationContext opCtx,
boolean retry) |
protected <T> @Nullable IgniteInternalFuture<T> |
asyncOpAcquire(boolean retry)
Tries to acquire asynchronous operations permit, if limited.
|
protected void |
asyncOpRelease(boolean retry)
Releases asynchronous operations permit, if limited.
|
void |
awaitLastFut()
Awaits for previous async operation to be completed.
|
<K1,V1> IgniteInternalCache<K1,V1> |
cache()
Gets base cache for this projection.
|
protected GridNearTxLocal |
checkCurrentTx() |
protected void |
checkJta()
Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary.
|
void |
clear()
Clears cache on all nodes that store it's data.
|
void |
clear(K key)
Clears key on all nodes that store it's data.
|
void |
clearAll(Set<? extends K> keys)
Clears keys on all nodes that store it's data.
|
IgniteInternalFuture<?> |
clearAllAsync(Set<? extends K> keys) |
IgniteInternalFuture<?> |
clearAsync() |
IgniteInternalFuture<?> |
clearAsync(K key) |
void |
clearLocally(boolean srv,
boolean near,
boolean readers)
Clears all entries from this cache only if the entry is not
currently locked or participating in a transaction.
|
void |
clearLocally(Collection<KeyCacheObject> keys,
boolean readers) |
boolean |
clearLocally(K key)
Clears an entry from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
void |
clearLocallyAll(Set<? extends K> keys,
boolean srv,
boolean near,
boolean readers)
Clears entries from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
CacheMetrics |
clusterMetrics()
Gets whole cluster metrics (statistics) for this cache.
|
CacheMetrics |
clusterMetrics(ClusterGroup grp)
Gets cluster group metrics (statistics) for this cache.
|
CacheMetricsMXBean |
clusterMxBean()
Gets whole cluster metrics (statistics) for this cache.
|
CacheConfiguration |
configuration()
Gets configuration bean for this cache.
|
boolean |
containsKey(K key) |
IgniteInternalFuture<Boolean> |
containsKeyAsync(K key) |
boolean |
containsKeys(Collection<? extends K> keys) |
IgniteInternalFuture<Boolean> |
containsKeysAsync(Collection<? extends K> keys) |
GridCacheContext<K,V> |
context() |
void |
decrementSize(GridCacheMapEntry e)
Decrements map public size.
|
Iterable<? extends GridCacheEntryEx> |
entries() |
GridCacheEntryEx |
entryEx(KeyCacheObject key) |
GridCacheEntryEx |
entryEx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
GridCacheEntryEx |
entryEx(Object key) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet()
Gets set of all entries cached on this node.
|
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(CacheEntryPredicate... filter) |
boolean |
evict(K key)
Evicts entry associated with given key from cache.
|
void |
evictAll(Collection<? extends K> keys)
Attempts to evict all entries associated with keys.
|
@Nullable javax.cache.expiry.ExpiryPolicy |
expiry() |
@Nullable IgniteCacheExpiryPolicy |
expiryPolicy(@Nullable javax.cache.expiry.ExpiryPolicy plc) |
GridCacheProxyImpl<K,V> |
forSubjectId(UUID subjId)
Creates projection for specified subject ID.
|
V |
get(K key)
Retrieves value mapped to the specified key from cache.
|
protected V |
get(K key,
String taskName,
boolean deserializeBinary,
boolean needVer) |
Map<K,V> |
getAll(@Nullable Collection<? extends K> keys)
Retrieves values mapped to the specified keys from cache.
|
protected Map<K,V> |
getAll(Collection<? extends K> keys,
boolean deserializeBinary,
boolean needVer,
boolean recovery,
boolean readRepair) |
IgniteInternalFuture<Map<K,V>> |
getAllAsync(@Nullable Collection<? extends K> keys)
Asynchronously retrieves values mapped to the specified keys from cache.
|
protected IgniteInternalFuture<Map<K,V>> |
getAllAsync(@Nullable Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
boolean recovery,
boolean readRepair,
boolean skipVals,
boolean needVer) |
IgniteInternalFuture<Map<K,V>> |
getAllAsync(@Nullable Collection<? extends K> keys,
@Nullable ReaderArguments readerArgs,
boolean readThrough,
boolean checkTx,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
boolean recovery,
boolean readRepair,
boolean forcePrimary,
@Nullable IgniteCacheExpiryPolicy expiry,
boolean skipVals,
boolean needVer) |
protected <K1,V1> IgniteInternalFuture<Map<K1,V1>> |
getAllAsync0(@Nullable Collection<KeyCacheObject> keys,
@Nullable ReaderArguments readerArgs,
boolean readThrough,
boolean checkTx,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
@Nullable IgniteCacheExpiryPolicy expiry,
boolean skipVals,
boolean keepCacheObjects,
boolean recovery,
boolean readRepair,
boolean needVer,
@Nullable String txLbl,
MvccSnapshot mvccSnapshot) |
@Nullable Map<K,V> |
getAllOutTx(Set<? extends K> keys)
Gets values from cache.
|
IgniteInternalFuture<Map<K,V>> |
getAllOutTxAsync(Set<? extends K> keys)
Gets values from cache.
|
V |
getAndPut(K key,
V val)
Stores given key-value pair in cache.
|
V |
getAndPut(K key,
V val,
@Nullable CacheEntryPredicate filter) |
protected V |
getAndPut0(K key,
V val,
@Nullable CacheEntryPredicate filter) |
IgniteInternalFuture<V> |
getAndPutAsync(K key,
V val)
Asynchronously stores given key-value pair in cache.
|
protected IgniteInternalFuture<V> |
getAndPutAsync(K key,
V val,
@Nullable CacheEntryPredicate filter) |
IgniteInternalFuture<V> |
getAndPutAsync0(K key,
V val,
@Nullable CacheEntryPredicate filter) |
V |
getAndPutIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
IgniteInternalFuture<V> |
getAndPutIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
V |
getAndRemove(K key)
Removes given key mapping from cache.
|
protected V |
getAndRemove0(K key) |
IgniteInternalFuture<V> |
getAndRemoveAsync(K key)
Asynchronously removes given key mapping from cache.
|
protected IgniteInternalFuture<V> |
getAndRemoveAsync0(K key) |
V |
getAndReplace(K key,
V val)
Stores given key-value pair in cache only if there is a previous mapping for it.
|
IgniteInternalFuture<V> |
getAndReplaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if there is a previous mapping for it.
|
IgniteInternalFuture<V> |
getAsync(K key)
Asynchronously retrieves value mapped to the specified key from cache.
|
protected IgniteInternalFuture<V> |
getAsync(K key,
boolean forcePrimary,
boolean skipTx,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
boolean skipVals,
boolean needVer) |
Collection<CacheEntry<K,V>> |
getEntries(@Nullable Collection<? extends K> keys)
Retrieves values mapped to the specified keys from cache.
|
IgniteInternalFuture<Collection<CacheEntry<K,V>>> |
getEntriesAsync(@Nullable Collection<? extends K> keys)
Asynchronously retrieves values mapped to the specified keys from cache.
|
@Nullable CacheEntry<K,V> |
getEntry(K key)
Retrieves value mapped to the specified key from cache.
|
IgniteInternalFuture<CacheEntry<K,V>> |
getEntryAsync(K key)
Asynchronously retrieves value mapped to the specified key from cache.
|
V |
getForcePrimary(K key)
Gets value from cache.
|
IgniteInternalFuture<V> |
getForcePrimaryAsync(K key)
Asynchronously gets value from cache.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
igniteIterator() |
Iterator<javax.cache.Cache.Entry<K,V>> |
igniteIterator(boolean keepBinary) |
void |
incrementSize(GridCacheMapEntry e)
Increments map public size.
|
protected void |
init()
Post constructor initialization for subclasses.
|
<T> @Nullable javax.cache.processor.EntryProcessorResult<T> |
invoke(@Nullable AffinityTopologyVersion topVer,
K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> javax.cache.processor.EntryProcessorResult<T> |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args) |
<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> |
invokeAsync(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
boolean |
isColocated() |
boolean |
isDht() |
boolean |
isDhtAtomic() |
boolean |
isEmpty()
Returns
true if this map contains no key-value mappings. |
boolean |
isLocal() |
boolean |
isLocked(K key)
Checks if any node owns a lock for this key.
|
boolean |
isLockedByThread(K key)
Checks if current thread owns a lock on this key.
|
boolean |
isNear() |
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
protected Iterator<javax.cache.Cache.Entry<K,V>> |
iterator(Iterator<? extends GridCacheEntryEx> it,
boolean deserializeBinary) |
<K1,V1> GridCacheProxyImpl<K1,V1> |
keepBinary()
Creates projection that will operate with binary objects.
|
Set<K> |
keySet()
Set of keys cached on this node.
|
IgniteInternalFuture<?> |
loadAll(Set<? extends K> keys,
boolean replaceExisting) |
Iterable<javax.cache.Cache.Entry<K,V>> |
localEntries(CachePeekMode[] peekModes) |
void |
localLoad(Collection<? extends K> keys,
@Nullable 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<?> |
localLoadCacheAsync(IgniteBiPredicate<K,V> p,
Object[] args)
Asynchronously delegates to
CacheStore.loadCache(IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. |
CacheMetrics |
localMetrics()
Gets local metrics (statistics) for this cache.
|
CacheMetricsMXBean |
localMxBean()
Gets local metrics (statistics) for this cache.
|
V |
localPeek(K key,
CachePeekMode[] peekModes) |
boolean |
localPreloadPartition(int part)
Preloads cache partition if it exists on local node.
|
int |
localSize(CachePeekMode[] peekModes) |
boolean |
lock(K key,
long timeout)
Synchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
boolean |
lockAll(@Nullable Collection<? extends K> keys,
long timeout)
All or nothing synchronous lock for passed in keys.
|
IgniteInternalFuture<Boolean> |
lockAsync(K key,
long timeout)
Asynchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
protected IgniteLogger |
log() |
Collection<Integer> |
lostPartitions() |
GridCacheConcurrentMap |
map() |
CacheMetricsImpl |
metrics0() |
String |
name()
Gets name of this cache (
null for default cache). |
int |
nearSize()
Gets size of near cache key set.
|
GridCacheVersion |
nextVersion()
Gets next grid cache version.
|
GridCacheVersion |
nextVersion(byte dataCenterId)
Gets next grid cache version.
|
long |
offHeapAllocatedSize()
Gets memory size allocated in off-heap.
|
long |
offHeapEntriesCount()
Gets number of cache entries stored in off-heap memory.
|
abstract void |
onDeferredDelete(GridCacheEntryEx entry,
GridCacheVersion ver) |
protected void |
onKernalStart()
Kernal start callback.
|
void |
onKernalStop()
Kernal stop callback.
|
void |
onReconnected() |
void |
onUndeploy(ClassLoader ldr)
Undeploys and removes all entries for class loader.
|
protected static GridCacheAdapter.PeekModes |
parsePeekModes(CachePeekMode[] peekModes,
boolean primary) |
@Nullable GridCacheEntryEx |
peekEx(KeyCacheObject key) |
@Nullable GridCacheEntryEx |
peekEx(Object key) |
abstract GridCachePreloader |
preloader() |
void |
preloadPartition(int part)
Preload cache partition.
|
IgniteInternalFuture<?> |
preloadPartitionAsync(int part)
Preload cache partition.
|
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.
|
boolean |
put(K key,
V val)
Stores given key-value pair in cache.
|
boolean |
put(K key,
V val,
CacheEntryPredicate filter) |
protected boolean |
put0(K key,
V val,
CacheEntryPredicate filter) |
void |
putAll(@Nullable Map<? extends K,? extends V> m)
Stores given key-value pairs in cache.
|
protected void |
putAll0(Map<? extends K,? extends V> m) |
IgniteInternalFuture<?> |
putAllAsync(Map<? extends K,? extends V> m)
Asynchronously stores given key-value pairs in cache.
|
protected IgniteInternalFuture<?> |
putAllAsync0(Map<? extends K,? extends V> m) |
void |
putAllConflict(Map<KeyCacheObject,GridCacheDrInfo> drMap)
Store DR data.
|
IgniteInternalFuture<?> |
putAllConflictAsync(Map<KeyCacheObject,GridCacheDrInfo> drMap)
Store DR data asynchronously.
|
IgniteInternalFuture<Boolean> |
putAsync(K key,
V val)
Stores given key-value pair in cache.
|
IgniteInternalFuture<Boolean> |
putAsync(K key,
V val,
@Nullable CacheEntryPredicate filter) |
IgniteInternalFuture<Boolean> |
putAsync0(K key,
V val,
@Nullable CacheEntryPredicate filter) |
boolean |
putIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
IgniteInternalFuture<Boolean> |
putIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
IgniteInternalFuture<?> |
rebalance()
Forces this cache node to re-balance its partitions.
|
boolean |
remove(K key)
Removes given key mapping from cache.
|
boolean |
remove(K key,
@Nullable CacheEntryPredicate filter) |
boolean |
remove(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
protected boolean |
remove0(K key,
CacheEntryPredicate filter) |
void |
removeAll()
Removes mappings from cache.
|
void |
removeAll(Collection<? extends K> keys)
Removes given key mappings from cache.
|
protected void |
removeAll0(Collection<? extends K> keys) |
IgniteInternalFuture<?> |
removeAllAsync(@Nullable Collection<? extends K> keys)
Asynchronously removes given key mappings from cache for entries.
|
protected IgniteInternalFuture<Object> |
removeAllAsync0(Collection<? extends K> keys) |
void |
removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap)
Removes DR data.
|
IgniteInternalFuture<?> |
removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap)
Removes DR data asynchronously.
|
IgniteInternalFuture<Boolean> |
removeAsync(K key)
Asynchronously removes given key mapping from cache.
|
IgniteInternalFuture<Boolean> |
removeAsync(K key,
@Nullable CacheEntryPredicate filter) |
IgniteInternalFuture<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.
|
protected IgniteInternalFuture<Boolean> |
removeAsync0(K key,
@Nullable CacheEntryPredicate filter) |
void |
removeEntry(GridCacheEntryEx entry) |
void |
removeIfObsolete(KeyCacheObject key) |
void |
removeMetrics()
Remove cache metrics.
|
V |
repairableGet(K key,
boolean deserializeBinary,
boolean needVer) |
protected Map<K,V> |
repairableGetAll(Collection<? extends K> keys,
boolean deserializeBinary,
boolean needVer,
boolean recovery,
boolean readRepair) |
IgniteInternalFuture<Map<K,V>> |
repairableGetAllAsync(@Nullable Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
boolean recovery,
boolean readRepair,
boolean skipVals,
boolean needVer) |
IgniteInternalFuture<V> |
repairableGetAsync(K key,
boolean deserializeBinary,
boolean needVer,
boolean readRepair) |
protected IgniteInternalFuture<Void> |
repairAsync(Collection<? extends K> keys,
CacheOperationContext opCtx,
boolean skipVals)
Checks the given
keys and repairs entries across the topology if needed. |
protected IgniteInternalFuture<Void> |
repairAsync(K key,
CacheOperationContext opCtx,
boolean skipVals)
Checks the given
key and repairs entry across the topology if needed. |
boolean |
replace(K key,
V val)
Stores given key-value pair in cache only if only 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. |
IgniteInternalFuture<Boolean> |
replaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.
|
IgniteInternalFuture<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. |
protected void |
saveFuture(GridCacheAdapter.FutureHolder holder,
IgniteInternalFuture<?> fut,
boolean retry)
Saves future in thread local holder and adds listener
that will clear holder when future is finished.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
scanIterator(boolean keepBinary,
@Nullable IgniteBiPredicate<Object,Object> p) |
GridCacheProxyImpl<K,V> |
setSkipStore(boolean skipStore) |
int |
size()
Gets the number of all entries cached on this node.
|
int |
size(CachePeekMode[] peekModes) |
IgniteInternalFuture<Integer> |
sizeAsync(CachePeekMode[] peekModes) |
long |
sizeLong()
Gets the number of all entries cached on this node as a long value.
|
long |
sizeLong(CachePeekMode[] peekModes) |
long |
sizeLong(int partition,
CachePeekMode[] peekModes) |
IgniteInternalFuture<Long> |
sizeLongAsync(CachePeekMode[] peekModes) |
IgniteInternalFuture<Long> |
sizeLongAsync(int part,
CachePeekMode[] peekModes) |
boolean |
skipStore() |
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally(boolean srv,
boolean near,
boolean readers)
Split clearLocally all task into multiple runnables.
|
abstract void |
start()
Starts this cache.
|
protected String |
startInfo()
Startup info.
|
void |
stop()
Stops this cache.
|
protected String |
stopInfo()
Stop info.
|
String |
toString() |
@Nullable GridNearTxLocal |
tx()
Gets transaction started by this thread or
null if this thread does
not have a transaction. |
abstract IgniteInternalFuture<Boolean> |
txLockAsync(Collection<KeyCacheObject> keys,
long timeout,
IgniteTxLocalEx tx,
boolean isRead,
boolean retval,
TransactionIsolation isolation,
boolean invalidate,
long createTtl,
long accessTtl) |
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation)
Starts new transaction with the specified concurrency and isolation.
|
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
int txSize)
Starts transaction with specified isolation, concurrency, timeout, invalidation flag,
and number of participating entries.
|
GridNearTxLocal |
txStartEx(TransactionConcurrency concurrency,
TransactionIsolation isolation) |
void |
unlock(K key)
Unlocks given key only if current thread owns the lock.
|
protected void |
warnIfUnordered(Collection<?> coll,
GridCacheAdapter.BulkOperation op)
Checks that given collection is sorted set, or processed inside deadlock-detecting transaction.
|
protected void |
warnIfUnordered(Map<?,?> m,
GridCacheAdapter.BulkOperation op)
Checks that given map is sorted or otherwise constant order, or processed inside deadlock-detecting transaction.
|
IgniteInternalCache<K,V> |
withAllowAtomicOpsInTx() |
GridCacheProxyImpl<K,V> |
withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc) |
IgniteInternalCache<K,V> |
withNoRetries() |
void |
writeExternal(ObjectOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
localSizeLong, localSizeLong, lockAllAsync, removeAllAsync, unlockAll
forEach, spliterator
public static final int CLEAR_ALL_SPLIT_THRESHOLD
public static final int DFLT_CACHE_START_SIZE
public static final int DFLT_START_CACHE_SIZE
public static final int DFLT_CACHE_RETRIES_COUNT
public static final int MAX_RETRIES
protected static final IgniteClosure RET2NULL
GridCacheReturn
-to-null conversion.protected ThreadLocal<GridCacheAdapter.FutureHolder> lastFut
@GridToStringExclude protected GridCacheContext<K,V> ctx
@GridToStringExclude protected GridCacheConcurrentMap map
@GridToStringExclude protected UUID locNodeId
@GridToStringExclude protected CacheConfiguration cacheCfg
protected CacheMetricsImpl metrics
protected IgniteLogger log
protected IgniteLogger txLockMsgLog
protected GridCacheAdapter()
Externalizable
.protected GridCacheAdapter(GridCacheContext<K,V> ctx)
ctx
- Cache context.protected GridCacheAdapter(GridCacheContext<K,V> ctx, @Nullable @Nullable GridCacheConcurrentMap map)
ctx
- Cache context.map
- Concurrent map.public String name()
null
for default cache).name
in interface IgniteInternalCache<K,V>
public void printMemoryStats()
public GridCacheConcurrentMap map()
public void incrementSize(GridCacheMapEntry e)
e
- Map entry.public void decrementSize(GridCacheMapEntry e)
e
- Map entry.public GridCacheContext<K,V> context()
context
in interface IgniteInternalCache<K,V>
protected IgniteLogger log()
public boolean isNear()
True
if this is near cache.public boolean isLocal()
True
if cache is local.public boolean isColocated()
True
if cache is colocated.public boolean isDhtAtomic()
True
if cache is DHT Atomic.public boolean isDht()
True
if cache is DHT.public boolean active()
public void active(boolean active)
active
- Active.public abstract GridCachePreloader preloader()
public final Affinity<K> affinity()
affinity
in interface IgniteInternalCache<K,V>
public final <K1,V1> IgniteInternalCache<K1,V1> cache()
cache
in interface IgniteInternalCache<K,V>
K1
- Cache key type.V1
- Cache value type.public final GridCacheProxyImpl<K,V> forSubjectId(UUID subjId)
forSubjectId
in interface IgniteInternalCache<K,V>
subjId
- Client ID.public final boolean skipStore()
skipStore
in interface IgniteInternalCache<K,V>
public final GridCacheProxyImpl<K,V> setSkipStore(boolean skipStore)
setSkipStore
in interface IgniteInternalCache<K,V>
skipStore
- Skip store flag.public final <K1,V1> GridCacheProxyImpl<K1,V1> keepBinary()
Projection returned by this method will force cache not to deserialize binary objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the projection can contain only following types:
org.gridgain.grid.binary.BinaryObject
for binary classesString
and array of String
sUUID
and array of UUID
sDate
and array of Date
sTimestamp
and array of Timestamp
s
For example, if you use Integer
as a key and Value
class as a value
(which will be stored in binary format), you should acquire following projection
to avoid deserialization:
IgniteInternalCacheprj = cache.keepBinary(); // Value is not deserialized and returned in binary format. GridBinaryObject po = prj.get(1);
Note that this method makes sense only if cache is working in binary mode
(org.apache.ignite.configuration.CacheConfiguration#isBinaryEnabled()
returns true
. If not,
this method is no-op and will return current projection.
keepBinary
in interface IgniteInternalCache<K,V>
@Nullable public final @Nullable javax.cache.expiry.ExpiryPolicy expiry()
expiry
in interface IgniteInternalCache<K,V>
ExpiryPolicy
associated with this projection.public final GridCacheProxyImpl<K,V> withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)
withExpiryPolicy
in interface IgniteInternalCache<K,V>
plc
- ExpiryPolicy
to associate with this projection.public final IgniteInternalCache<K,V> withNoRetries()
withNoRetries
in interface IgniteInternalCache<K,V>
public final IgniteInternalCache<K,V> withAllowAtomicOpsInTx()
withAllowAtomicOpsInTx
in interface IgniteInternalCache<K,V>
public final CacheConfiguration configuration()
configuration
in interface IgniteInternalCache<K,V>
public abstract IgniteInternalFuture<Boolean> txLockAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isRead, boolean retval, TransactionIsolation isolation, boolean invalidate, long createTtl, long accessTtl)
keys
- Keys to lock.timeout
- Lock timeout.tx
- Transaction.isRead
- True
for read operations.retval
- Flag to return value.isolation
- Transaction isolation.invalidate
- Invalidate flag.createTtl
- TTL for create operation.accessTtl
- TTL for read operation.protected void init()
public abstract void start() throws IgniteCheckedException
IgniteCheckedException
- If start failed.protected final String startInfo()
public void stop()
public void removeMetrics()
protected final String stopInfo()
protected void onKernalStart() throws IgniteCheckedException
IgniteCheckedException
- If callback failed.public void onKernalStop()
public final boolean isEmpty()
true
if this map contains no key-value mappings.isEmpty
in interface IgniteInternalCache<K,V>
true
if this map contains no key-value mappings.public final boolean containsKey(K key)
containsKey
in interface IgniteInternalCache<K,V>
key
- Key.True
if cache contains mapping for a given key.public final IgniteInternalFuture<Boolean> containsKeyAsync(K key)
containsKeyAsync
in interface IgniteInternalCache<K,V>
key
- Key.public final boolean containsKeys(Collection<? extends K> keys)
containsKeys
in interface IgniteInternalCache<K,V>
keys
- Keys,True
if cache contains all keys.public final IgniteInternalFuture<Boolean> containsKeysAsync(Collection<? extends K> keys)
containsKeysAsync
in interface IgniteInternalCache<K,V>
keys
- Keys to check.public final Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode[] peekModes) throws IgniteCheckedException
localEntries
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.IgniteCheckedException
- If failed.public final V localPeek(K key, CachePeekMode[] peekModes) throws IgniteCheckedException
localPeek
in interface IgniteInternalCache<K,V>
key
- Key.peekModes
- Peek modes.IgniteCheckedException
- If failed.public final void onUndeploy(ClassLoader ldr)
ldr
- Class loader to undeploy.@Nullable public final @Nullable GridCacheEntryEx peekEx(KeyCacheObject key)
key
- Entry key.@Nullable public final @Nullable GridCacheEntryEx peekEx(Object key)
key
- Entry key.public final GridCacheEntryEx entryEx(Object key)
key
- Entry key.null
).public final GridCacheEntryEx entryEx(KeyCacheObject key)
key
- Entry key.null
).public GridCacheEntryEx entryEx(KeyCacheObject key, AffinityTopologyVersion topVer)
topVer
- Topology version.key
- Entry key.null
).public final Iterable<? extends GridCacheEntryEx> entries()
public final Iterable<? extends GridCacheEntryEx> allEntries()
public final Set<javax.cache.Cache.Entry<K,V>> entrySet()
NOTE: this operation is not distributed and returns only the entries cached on this node.
entrySet
in interface IgniteInternalCache<K,V>
public final Set<K> keySet()
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
keySet
in interface IgniteInternalCache<K,V>
public final void removeIfObsolete(KeyCacheObject key)
key
- Entry key.public List<GridCacheClearAllRunnable<K,V>> splitClearLocally(boolean srv, boolean near, boolean readers)
srv
- Whether to clear server cache.near
- Whether to clear near cache.readers
- Whether to clear readers.public boolean clearLocally(K key)
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
clearLocally
in interface IgniteInternalCache<K,V>
key
- Key to clearLocally.True
if entry was successfully cleared from cache, false
if entry was in use at the time of this method invocation and could not be
cleared.public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers)
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
clearLocallyAll
in interface IgniteInternalCache<K,V>
keys
- Keys to clearLocally.srv
- Whether to clear server cache.near
- Whether to clear near cache.readers
- Whether to clear readers.public void clearLocally(boolean srv, boolean near, boolean readers)
Note that this operation is local as it merely clears entries from local cache. It does not remove entries from remote caches or from underlying persistent storage.
clearLocally
in interface IgniteInternalCache<K,V>
srv
- Whether to clear server cache.near
- Whether to clear near cache.readers
- Whether to clear readers.public void clear() throws IgniteCheckedException
IgniteInternalCache.clearLocally(boolean, boolean, boolean)
method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clear
in interface IgniteInternalCache<K,V>
IgniteCheckedException
- In case of cache could not be cleared on any of the nodes.public void clear(K key) throws IgniteCheckedException
IgniteInternalCache.clearLocally(Object)
method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clear
in interface IgniteInternalCache<K,V>
key
- Key to clear.IgniteCheckedException
- In case of cache could not be cleared on any of the nodes.public void clearAll(Set<? extends K> keys) throws IgniteCheckedException
IgniteInternalCache.clearLocallyAll(Set, boolean, boolean, boolean)
method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clearAll
in interface IgniteInternalCache<K,V>
keys
- Keys to clear.IgniteCheckedException
- In case of cache could not be cleared on any of the nodes.public IgniteInternalFuture<?> clearAsync()
clearAsync
in interface IgniteInternalCache<K,V>
public IgniteInternalFuture<?> clearAsync(K key)
clearAsync
in interface IgniteInternalCache<K,V>
key
- Key to clear.public IgniteInternalFuture<?> clearAllAsync(Set<? extends K> keys)
clearAllAsync
in interface IgniteInternalCache<K,V>
keys
- Keys to clear.public void clearLocally(Collection<KeyCacheObject> keys, boolean readers)
keys
- Keys.readers
- Readers flag.public final void removeEntry(GridCacheEntryEx entry)
entry
- Removes entry from cache if currently mapped value is the same as passed.public Collection<Integer> lostPartitions()
lostPartitions
in interface IgniteInternalCache<K,V>
public final V getForcePrimary(K key) throws IgniteCheckedException
getForcePrimary
in interface IgniteInternalCache<K,V>
key
- Key to get value for.IgniteCheckedException
- If failed.public final IgniteInternalFuture<V> getForcePrimaryAsync(K key)
getForcePrimaryAsync
in interface IgniteInternalCache<K,V>
key
- Key to get value for.@Nullable public final @Nullable Map<K,V> getAllOutTx(Set<? extends K> keys) throws IgniteCheckedException
getAllOutTx
in interface IgniteInternalCache<K,V>
keys
- Keys to get values for.IgniteCheckedException
- If failed.public final IgniteInternalFuture<Map<K,V>> getAllOutTxAsync(Set<? extends K> keys)
getAllOutTxAsync
in interface IgniteInternalCache<K,V>
keys
- Keys to get values for.@Nullable public V get(K key) throws IgniteCheckedException
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disable, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#load(Transaction, Object)
method.
get
in interface IgniteInternalCache<K,V>
key
- Key to retrieve the value for.IgniteCheckedException
- If get operation failed.@Nullable public @Nullable CacheEntry<K,V> getEntry(K key) throws IgniteCheckedException
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disable, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#load(Transaction, Object)
method.
getEntry
in interface IgniteInternalCache<K,V>
key
- Key to retrieve the value for.IgniteCheckedException
- If get operation failed.public IgniteInternalFuture<V> getAsync(K key)
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#load(Transaction, Object)
method.
getAsync
in interface IgniteInternalCache<K,V>
key
- Key for the value to get.public IgniteInternalFuture<CacheEntry<K,V>> getEntryAsync(K key)
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#load(Transaction, Object)
method.
getEntryAsync
in interface IgniteInternalCache<K,V>
key
- Key for the value to get.public final Map<K,V> getAll(@Nullable @Nullable Collection<? extends K> keys) throws IgniteCheckedException
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure)
method.
getAll
in interface IgniteInternalCache<K,V>
keys
- Keys to get.IgniteCheckedException
- If get operation failed.public Collection<CacheEntry<K,V>> getEntries(@Nullable @Nullable Collection<? extends K> keys) throws IgniteCheckedException
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure)
method.
getEntries
in interface IgniteInternalCache<K,V>
keys
- Keys to get.IgniteCheckedException
- If get operation failed.public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable @Nullable Collection<? extends K> keys)
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure)
method.
getAllAsync
in interface IgniteInternalCache<K,V>
keys
- Key for the value to get.public IgniteInternalFuture<Collection<CacheEntry<K,V>>> getEntriesAsync(@Nullable @Nullable Collection<? extends K> keys)
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore
persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure)
method.
getEntriesAsync
in interface IgniteInternalCache<K,V>
keys
- Key for the value to get.protected IgniteInternalFuture<V> getAsync(K key, boolean forcePrimary, boolean skipTx, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean skipVals, boolean needVer)
key
- Key.forcePrimary
- Force primary.skipTx
- Skip tx.subjId
- Subj Id.taskName
- Task name.deserializeBinary
- Deserialize binary.skipVals
- Skip values.needVer
- Need version.protected IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable @Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, boolean readRepair, boolean skipVals, boolean needVer)
keys
- Keys.forcePrimary
- Force primary.skipTx
- Skip tx.subjId
- Subj Id.taskName
- Task name.deserializeBinary
- Deserialize binary.recovery
- Recovery mode flag.skipVals
- Skip values.needVer
- Need version.getAllAsync(Collection)
public final IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable @Nullable Collection<? extends K> keys, @Nullable @Nullable ReaderArguments readerArgs, boolean readThrough, boolean checkTx, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, boolean readRepair, boolean forcePrimary, @Nullable @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals, boolean needVer)
keys
- Keys.readerArgs
- Near cache reader will be added if not null.readThrough
- Read through.checkTx
- Check tx.subjId
- Subj Id.taskName
- Task name.deserializeBinary
- Deserialize binary.recovery
- Recovery flag.forcePrimary
- Froce primary.expiry
- Expiry policy.skipVals
- Skip values.needVer
- Need version.getAllAsync(Collection)
protected final <K1,V1> IgniteInternalFuture<Map<K1,V1>> getAllAsync0(@Nullable @Nullable Collection<KeyCacheObject> keys, @Nullable @Nullable ReaderArguments readerArgs, boolean readThrough, boolean checkTx, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, @Nullable @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals, boolean keepCacheObjects, boolean recovery, boolean readRepair, boolean needVer, @Nullable @Nullable String txLbl, MvccSnapshot mvccSnapshot)
keys
- Keys.readerArgs
- Near cache reader will be added if not null.readThrough
- Read-through flag.checkTx
- Check local transaction flag.subjId
- Subject ID.taskName
- Task name/deserializeBinary
- Deserialize binary flag.expiry
- Expiry policy.skipVals
- Skip values flag.keepCacheObjects
- Keep cache objects.needVer
- If true
returns values as tuples containing value and version.txLbl
- Transaction label.mvccSnapshot
- MVCC snapshot.protected GridNearTxLocal checkCurrentTx()
public final V getAndPut(K key, V val) throws IgniteCheckedException
CacheMode.PARTITIONED
or CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])
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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndPut
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.null
if entry did not pass the filter, or if there was no mapping for the key in swap
or in persistent storage.IgniteCheckedException
- If put operation failed.@Nullable public V getAndPut(K key, V val, @Nullable @Nullable CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.val
- Value.filter
- Optional filter.IgniteCheckedException
- If failed.protected V getAndPut0(K key, V val, @Nullable @Nullable CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.val
- Value.filter
- Optional filter.IgniteCheckedException
- If failed.public final IgniteInternalFuture<V> getAndPutAsync(K key, V val)
CacheMode.REPLICATED
caches, the value will be loaded from swap
and, if it's not there, and read-through is allowed, from the underlying
CacheStore
storage. In case of CacheMode.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 and read-through is allowed,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[])
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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndPutAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.protected final IgniteInternalFuture<V> getAndPutAsync(K key, V val, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key.val
- Value.filter
- Filter.public IgniteInternalFuture<V> getAndPutAsync0(K key, V val, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key.val
- Value.filter
- Optional filter.public final boolean put(K key, V val) throws IgniteCheckedException
This method will return true
if value is stored in cache and false
otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])
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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
put
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.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.IgniteCheckedException
- If put operation failed.public boolean put(K key, V val, CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.val
- Value.filter
- Filter.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.IgniteCheckedException
- If put operation failed.protected boolean put0(K key, V val, CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.val
- Value.filter
- Filter.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.IgniteCheckedException
- If put operation failed.public void putAllConflict(Map<KeyCacheObject,GridCacheDrInfo> drMap) throws IgniteCheckedException
putAllConflict
in interface IgniteInternalCache<K,V>
drMap
- DR map.IgniteCheckedException
- If put operation failed.public IgniteInternalFuture<?> putAllConflictAsync(Map<KeyCacheObject,GridCacheDrInfo> drMap) throws IgniteCheckedException
putAllConflictAsync
in interface IgniteInternalCache<K,V>
drMap
- DR map.IgniteCheckedException
- If put operation failed.@Nullable public final <T> @Nullable javax.cache.processor.EntryProcessorResult<T> invoke(@Nullable @Nullable AffinityTopologyVersion topVer, K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws IgniteCheckedException
invoke
in interface IgniteInternalCache<K,V>
topVer
- Locked topology version.key
- Key.entryProcessor
- Entry processor.args
- Arguments.IgniteCheckedException
- If failed.public <T> javax.cache.processor.EntryProcessorResult<T> invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws IgniteCheckedException
invoke
in interface IgniteInternalCache<K,V>
key
- Key.entryProcessor
- Entry processor.args
- Arguments.IgniteCheckedException
- If failed.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws IgniteCheckedException
invokeAll
in interface IgniteInternalCache<K,V>
keys
- Keys.entryProcessor
- Entry processor.args
- Arguments.IgniteCheckedException
- If failed.public <T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> invokeAsync(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws javax.cache.processor.EntryProcessorException
invokeAsync
in interface IgniteInternalCache<K,V>
key
- Key.entryProcessor
- Entry processor.args
- Arguments.javax.cache.processor.EntryProcessorException
public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)
invokeAllAsync
in interface IgniteInternalCache<K,V>
keys
- Keys.entryProcessor
- Entry processor.args
- Arguments.public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)
invokeAllAsync
in interface IgniteInternalCache<K,V>
map
- Map containing keys and entry processors to be applied to values.args
- Arguments.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args) throws IgniteCheckedException
invokeAll
in interface IgniteInternalCache<K,V>
map
- Map containing keys and entry processors to be applied to values.args
- Arguments.IgniteCheckedException
- If failed.public final IgniteInternalFuture<Boolean> putAsync(K key, V val)
This method will return true
if value is stored in cache and false
otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])
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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
putAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.true
if optional filter
passed and value was stored in cache, false
otherwise. Note that future will
return true
if filter is not specified.public final IgniteInternalFuture<Boolean> putAsync(K key, V val, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key.val
- Value.filter
- Filter.public IgniteInternalFuture<Boolean> putAsync0(K key, V val, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key.val
- Value.filter
- Optional filter.@Nullable public final V getAndPutIfAbsent(K key, V val) throws IgniteCheckedException
CacheMode.PARTITIONED
or CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method IgniteInternalCache.putIfAbsent(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndPutIfAbsent
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.IgniteCheckedException
- If put operation failed.public final IgniteInternalFuture<V> getAndPutIfAbsentAsync(K key, V val)
CacheMode.PARTITIONED
or CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method IgniteInternalCache.putIfAbsentAsync(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndPutIfAbsentAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.public final boolean putIfAbsent(K key, V val) throws IgniteCheckedException
This method will return true
if value is stored in cache and false
otherwise.
Unlike IgniteInternalCache.getAndPutIfAbsent(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
putIfAbsent
in interface IgniteInternalCache<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.IgniteCheckedException
- If put operation failed.public final IgniteInternalFuture<Boolean> putIfAbsentAsync(K key, V val)
This method will return true
if value is stored in cache and false
otherwise.
Unlike IgniteInternalCache.getAndPutIfAbsent(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
putIfAbsentAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.@Nullable public final V getAndReplace(K key, V val) throws IgniteCheckedException
CacheMode.PARTITIONED
or CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method IgniteInternalCache.replace(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndReplace
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.IgniteCheckedException
- If replace operation failed.public final IgniteInternalFuture<V> getAndReplaceAsync(K key, V val)
CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method IgniteInternalCache.replace(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
getAndReplaceAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.public final boolean replace(K key, V val) throws IgniteCheckedException
This method will return true
if value is stored in cache and false
otherwise.
Unlike IgniteInternalCache.getAndReplace(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
replace
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.True
if replace happened, false
otherwise.IgniteCheckedException
- If replace operation failed.public final IgniteInternalFuture<Boolean> replaceAsync(K key, V val)
This method will return true
if value is stored in cache and false
otherwise.
Unlike IgniteInternalCache.getAndReplaceAsync(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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
replaceAsync
in interface IgniteInternalCache<K,V>
key
- Key to store in cache.val
- Value to be associated with the given key.public final boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException
'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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
replace
in interface IgniteInternalCache<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.IgniteCheckedException
- If replace operation failed.public IgniteInternalFuture<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 CacheStore
via CacheStore#put(Transaction, Object, Object)
method.
replaceAsync
in interface IgniteInternalCache<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(@Nullable @Nullable Map<? extends K,? extends V> m) throws IgniteCheckedException
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map)
method.
putAll
in interface IgniteInternalCache<K,V>
m
- Key-value pairs to store in cache.IgniteCheckedException
- If put operation failed.protected void putAll0(Map<? extends K,? extends V> m) throws IgniteCheckedException
m
- Map.IgniteCheckedException
- If failed.public IgniteInternalFuture<?> putAllAsync(Map<? extends K,? extends V> m)
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map)
method.
putAllAsync
in interface IgniteInternalCache<K,V>
m
- Key-value pairs to store in cache.protected IgniteInternalFuture<?> putAllAsync0(Map<? extends K,? extends V> m)
m
- Map.@Nullable public V getAndRemove(K key) throws IgniteCheckedException
CacheMode.PARTITIONED
or CacheMode.REPLICATED
caches, the value will be loaded from the primary node, which in its turn may load the value
from the disk-based swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[])
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 value will be removed from CacheStore
via CacheStore#remove(Transaction, Object)
method.
getAndRemove
in interface IgniteInternalCache<K,V>
key
- Key whose mapping is to be removed from cache.null
if there was no value for this key.IgniteCheckedException
- If remove operation failed.protected V getAndRemove0(K key) throws IgniteCheckedException
key
- Key.IgniteCheckedException
- If failed.public IgniteInternalFuture<V> getAndRemoveAsync(K key)
CacheMode.PARTITIONED
or CacheMode.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, CacheStore#load(Transaction, Object)
method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[])
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 value will be removed from CacheStore
via CacheStore#remove(Transaction, Object)
method.
getAndRemoveAsync
in interface IgniteInternalCache<K,V>
key
- Key whose mapping is to be removed from cache.protected IgniteInternalFuture<V> getAndRemoveAsync0(K key)
key
- Key.public void removeAll() throws IgniteCheckedException
USE WITH CARE - if your cache has many entries then transaction will quickly become very heavy and slow.
If write-through is enabled, the values will be removed from CacheStore
via IgniteDataStreamer
.
removeAll
in interface IgniteInternalCache<K,V>
IgniteCheckedException
- If remove failed.public void removeAll(Collection<? extends K> keys) throws IgniteCheckedException
If write-through is enabled, the values will be removed from CacheStore
via IgniteDataStreamer
.
removeAll
in interface IgniteInternalCache<K,V>
keys
- Keys whose mappings are to be removed from cache.IgniteCheckedException
- If remove failed.protected void removeAll0(Collection<? extends K> keys) throws IgniteCheckedException
keys
- Keys.IgniteCheckedException
- If failed.public IgniteInternalFuture<?> removeAllAsync(@Nullable @Nullable Collection<? extends K> keys)
If write-through is enabled, the values will be removed from CacheStore
via IgniteDataStreamer
.
removeAllAsync
in interface IgniteInternalCache<K,V>
keys
- Keys whose mappings are to be removed from cache.protected IgniteInternalFuture<Object> removeAllAsync0(Collection<? extends K> keys)
keys
- Keys.public boolean remove(K key) throws IgniteCheckedException
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 CacheStore
via CacheStore#remove(Transaction, Object)
method.
remove
in interface IgniteInternalCache<K,V>
key
- Key whose mapping is to be removed from cache.True
if filter passed validation and entry was removed, false
otherwise.
Note that if filter is not specified, this method will return true
.IgniteCheckedException
- If remove failed.public boolean remove(K key, @Nullable @Nullable CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.filter
- Filter.True
if entry was removed.IgniteCheckedException
- If failed.protected boolean remove0(K key, CacheEntryPredicate filter) throws IgniteCheckedException
key
- Key.filter
- Filter.True
if entry was removed.IgniteCheckedException
- If failed.public IgniteInternalFuture<Boolean> removeAsync(K key)
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 CacheStore
via CacheStore#remove(Transaction, Object)
method.
removeAsync
in interface IgniteInternalCache<K,V>
key
- Key whose mapping is to be removed from cache.true
if optional filters passed validation and remove did occur, false
otherwise.
Note that if filter is not specified, this method will return true
.public IgniteInternalFuture<Boolean> removeAsync(K key, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key to remove.filter
- Optional filter.protected IgniteInternalFuture<Boolean> removeAsync0(K key, @Nullable @Nullable CacheEntryPredicate filter)
key
- Key.filter
- Filter.public void removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap) throws IgniteCheckedException
removeAllConflict
in interface IgniteInternalCache<K,V>
drMap
- DR map.IgniteCheckedException
- If remove failed.public IgniteInternalFuture<?> removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap) throws IgniteCheckedException
removeAllConflictAsync
in interface IgniteInternalCache<K,V>
drMap
- DR map.IgniteCheckedException
- If remove failed.public final boolean remove(K key, V val) throws IgniteCheckedException
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object)
method.
remove
in interface IgniteInternalCache<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.IgniteCheckedException
- If remove failed.public final IgniteInternalFuture<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 CacheStore
via CacheStore#remove(Transaction, Object)
method.
removeAsync
in interface IgniteInternalCache<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 final CacheMetrics clusterMetrics()
clusterMetrics
in interface IgniteInternalCache<K,V>
public CacheMetrics clusterMetrics(ClusterGroup grp)
clusterMetrics
in interface IgniteInternalCache<K,V>
grp
- Cluster group.public CacheMetrics localMetrics()
localMetrics
in interface IgniteInternalCache<K,V>
public CacheMetricsMXBean localMxBean()
localMxBean
in interface IgniteInternalCache<K,V>
public CacheMetricsMXBean clusterMxBean()
clusterMxBean
in interface IgniteInternalCache<K,V>
public CacheMetricsImpl metrics0()
@Nullable public @Nullable GridNearTxLocal tx()
null
if this thread does
not have a transaction.tx
in interface IgniteInternalCache<K,V>
null
if this thread
does not have a transaction.public boolean lock(K key, long timeout) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC
concurrency control for transaction
which will acquire explicit locks for relevant cache operations.lock
in interface IgniteInternalCache<K,V>
key
- Key to lock.timeout
- Timeout in milliseconds to wait for lock to be acquired
('0'
for no expiration), -1
for immediate failure if
lock cannot be acquired immediately).True
if all filters passed and lock was acquired,
false
otherwise.IgniteCheckedException
- If lock acquisition resulted in error.public boolean lockAll(@Nullable @Nullable Collection<? extends K> keys, long timeout) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC
concurrency control for transaction
which will acquire explicit locks for relevant cache operations.lockAll
in interface IgniteInternalCache<K,V>
keys
- Keys to lock.timeout
- Timeout in milliseconds to wait for lock to be acquired
('0'
for no expiration).True
if all filters passed and locks were acquired before
timeout has expired, false
otherwise.IgniteCheckedException
- If lock acquisition resulted in error.public IgniteInternalFuture<Boolean> lockAsync(K key, long timeout)
TransactionConcurrency.PESSIMISTIC
concurrency control for transaction
which will acquire explicit locks for relevant cache operations.lockAsync
in interface IgniteInternalCache<K,V>
key
- Key to lock.timeout
- Timeout in milliseconds to wait for lock to be acquired
('0'
for no expiration, -1
for immediate failure if
lock cannot be acquired immediately).true
whenever all filters pass and locks are acquired before timeout is expired,
false
otherwise.public void unlock(K key) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC
concurrency control for transaction
which will acquire explicit locks for relevant cache operations.unlock
in interface IgniteInternalCache<K,V>
key
- Key to unlock.IgniteCheckedException
- If unlock execution resulted in error.public boolean isLocked(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
isLocked
in interface IgniteInternalCache<K,V>
key
- Key to check.True
if lock is owned by some node.public boolean isLockedByThread(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
isLockedByThread
in interface IgniteInternalCache<K,V>
key
- Key to check.True
if key is locked by current thread.public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation)
txStart
in interface IgniteInternalCache<K,V>
concurrency
- Concurrency.isolation
- Isolation.public GridNearTxLocal txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation)
txStartEx
in interface IgniteInternalCache<K,V>
concurrency
- Concurrency.isolation
- Isolation.public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize) throws IllegalStateException
txStart
in interface IgniteInternalCache<K,V>
concurrency
- Concurrency.isolation
- Isolation.timeout
- Timeout.txSize
- Number of entries participating in transaction (may be approximate).IllegalStateException
- If transaction is already started by this thread.protected void checkJta() throws IgniteCheckedException
IgniteCheckedException
- In case of error.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>
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 IgniteInternalFuture<?> localLoadCacheAsync(IgniteBiPredicate<K,V> p, Object[] args)
CacheStore.loadCache(IgniteBiInClosure, Object...)
method
to reload state from the underlying persistent storage. The reloaded 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 reloaded 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.
localLoadCacheAsync
in interface IgniteInternalCache<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.public IgniteInternalFuture<?> loadAll(Set<? extends K> keys, boolean replaceExisting)
keys
- Keys.replaceExisting
- Replace existing values flag.public void localLoad(Collection<? extends K> keys, @Nullable @Nullable javax.cache.expiry.ExpiryPolicy plc, boolean keepBinary) throws IgniteCheckedException
keys
- Keys to load.plc
- Optional expiry policy.IgniteCheckedException
- If failed.public int size(CachePeekMode[] peekModes) throws IgniteCheckedException
size
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.IgniteCheckedException
- If failed.public long sizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException
sizeLong
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.IgniteCheckedException
- If failed.public long sizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException
sizeLong
in interface IgniteInternalCache<K,V>
partition
- partitionpeekModes
- Peek modes.IgniteCheckedException
- If failed.public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes)
sizeAsync
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.public IgniteInternalFuture<Long> sizeLongAsync(CachePeekMode[] peekModes)
sizeLongAsync
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.public IgniteInternalFuture<Long> sizeLongAsync(int part, CachePeekMode[] peekModes)
sizeLongAsync
in interface IgniteInternalCache<K,V>
part
- partitonpeekModes
- Peek modes.public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException
localSize
in interface IgniteInternalCache<K,V>
peekModes
- Peek modes.IgniteCheckedException
- If 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>
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>
public int nearSize()
Note that for LOCAL
non-distributed caches this method will always return 0
nearSize
in interface IgniteInternalCache<K,V>
0
if cache is not CacheMode.PARTITIONED
.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>
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>
public Iterator<javax.cache.Cache.Entry<K,V>> scanIterator(boolean keepBinary, @Nullable @Nullable IgniteBiPredicate<Object,Object> p) throws IgniteCheckedException
scanIterator
in interface IgniteInternalCache<K,V>
keepBinary
- Keep binary flag.p
- Optional key/value predicate.IgniteCheckedException
- If failed.public Iterator<javax.cache.Cache.Entry<K,V>> igniteIterator() throws IgniteCheckedException
IgniteCheckedException
- If failed.public Iterator<javax.cache.Cache.Entry<K,V>> igniteIterator(boolean keepBinary) throws IgniteCheckedException
keepBinary
- Keep binary flag.IgniteCheckedException
- If failed.public GridCacheVersion nextVersion()
public GridCacheVersion nextVersion(byte dataCenterId)
dataCenterId
- Data center id.public long offHeapEntriesCount()
offHeapEntriesCount
in interface IgniteInternalCache<K,V>
public long offHeapAllocatedSize()
offHeapAllocatedSize
in interface IgniteInternalCache<K,V>
public void awaitLastFut()
protected <T> IgniteInternalFuture<T> asyncOp(GridNearTxLocal tx, GridCacheAdapter.AsyncOp<T> op, CacheOperationContext opCtx, boolean retry)
T
- Return type.tx
- Transaction.op
- Cache operation.opCtx
- Cache operation context.protected void saveFuture(GridCacheAdapter.FutureHolder holder, IgniteInternalFuture<?> fut, boolean retry)
holder
- Future holder.fut
- Future to save.@Nullable protected <T> @Nullable IgniteInternalFuture<T> asyncOpAcquire(boolean retry)
retry
- Retry flag.protected final void asyncOpRelease(boolean retry)
retry
- Retry flag.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
protected Object readResolve() throws ObjectStreamException
ObjectStreamException
- Thrown in case of unmarshalling error.public IgniteInternalFuture<?> rebalance()
CacheConfiguration.getRebalanceDelay()
configuration parameter has non-zero value.
When many nodes are started or stopped almost concurrently, it is more efficient to delay
rebalancing until the node topology is stable to make sure that no redundant re-partitioning
happens.
In case ofCacheMode.PARTITIONED
caches, for better efficiency user should
usually make sure that new nodes get placed on the same place of consistent hash ring as
the left nodes, and that nodes are restarted before
rebalanceDelay
expires. To place nodes
on the same place in consistent hash ring, use
IgniteConfiguration.setConsistentId(Serializable)
to make sure that
a node maps to the same hash ID if re-started.
See CacheConfiguration.getRebalanceDelay()
for more information on how to configure
rebalance re-partition delay.
rebalance
in interface IgniteInternalCache<K,V>
public boolean evict(K key)
evict
in interface IgniteInternalCache<K,V>
key
- Key to evict from cache.True
if entry could be evicted, false
otherwise.public void evictAll(Collection<? extends K> keys)
evictAll
in interface IgniteInternalCache<K,V>
keys
- Keys to evict.public Set<javax.cache.Cache.Entry<K,V>> entrySet(@Nullable CacheEntryPredicate... filter)
filter
- Filters to evaluate.@Nullable public final V repairableGet(K key, boolean deserializeBinary, boolean needVer) throws IgniteCheckedException
key
- Key.deserializeBinary
- Deserialize binary flag.needVer
- Need version.IgniteCheckedException
- If failed.protected V get(K key, String taskName, boolean deserializeBinary, boolean needVer) throws IgniteCheckedException
key
- Key.taskName
- Task name.deserializeBinary
- Deserialize binary flag.needVer
- Need version.IgniteCheckedException
- If failed.public final IgniteInternalFuture<V> repairableGetAsync(K key, boolean deserializeBinary, boolean needVer, boolean readRepair)
key
- Key.deserializeBinary
- Deserialize binary flag.needVer
- Need version.protected Map<K,V> repairableGetAll(Collection<? extends K> keys, boolean deserializeBinary, boolean needVer, boolean recovery, boolean readRepair) throws IgniteCheckedException
keys
- Keys.deserializeBinary
- Deserialize binary flag.needVer
- Need version.IgniteCheckedException
- If read failed.protected Map<K,V> getAll(Collection<? extends K> keys, boolean deserializeBinary, boolean needVer, boolean recovery, boolean readRepair) throws IgniteCheckedException
keys
- Keys.deserializeBinary
- Deserialize binary flag.needVer
- Need version.recovery
- Recovery flag.readRepair
- Read repair flag.IgniteCheckedException
- If read failed.public IgniteInternalFuture<Map<K,V>> repairableGetAllAsync(@Nullable @Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, boolean readRepair, boolean skipVals, boolean needVer)
keys
- Keys.forcePrimary
- Force primary.skipTx
- Skip tx.subjId
- Subj Id.taskName
- Task name.deserializeBinary
- Deserialize binary.recovery
- Recovery mode flag.skipVals
- Skip values.needVer
- Need version.getAllAsync(Collection)
protected IgniteInternalFuture<Void> repairAsync(Collection<? extends K> keys, CacheOperationContext opCtx, boolean skipVals)
keys
and repairs entries across the topology if needed.keys
- Keys.opCtx
- Operation context.skipVals
- Skip values flag.protected IgniteInternalFuture<Void> repairAsync(K key, CacheOperationContext opCtx, boolean skipVals)
key
and repairs entry across the topology if needed.key
- Key.opCtx
- Operation context.skipVals
- Skip values flag.public abstract void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)
entry
- Entry.ver
- Version.public void onReconnected()
protected void warnIfUnordered(Map<?,?> m, GridCacheAdapter.BulkOperation op)
m
- Map to examine.protected void warnIfUnordered(Collection<?> coll, GridCacheAdapter.BulkOperation op)
coll
- Collection to examine.protected final Iterator<javax.cache.Cache.Entry<K,V>> iterator(Iterator<? extends GridCacheEntryEx> it, boolean deserializeBinary)
it
- Internal entry iterator.deserializeBinary
- Deserialize binary flag.public void preloadPartition(int part) throws IgniteCheckedException
preloadPartition
in interface IgniteInternalCache<K,V>
part
- Partition.IgniteCheckedException
- If failed.public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException
preloadPartitionAsync
in interface IgniteInternalCache<K,V>
part
- Partition.IgniteCheckedException
- If failed.public boolean localPreloadPartition(int part) throws IgniteCheckedException
localPreloadPartition
in interface IgniteInternalCache<K,V>
part
- Partition.True
if partition was preloaded, false
if it doesn't belong to local node.IgniteCheckedException
- If failed.protected static GridCacheAdapter.PeekModes parsePeekModes(CachePeekMode[] peekModes, boolean primary)
peekModes
- Cache peek modes array.primary
- Defines the default behavior if affinity flags are not specified.@Nullable public final @Nullable IgniteCacheExpiryPolicy expiryPolicy(@Nullable @Nullable javax.cache.expiry.ExpiryPolicy plc)
plc
- Explicitly specified expiry policy for cache operation.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021