Class GridDistributedCacheAdapter<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheAdapter<K,V>
-
- org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter<K,V>
-
- All Implemented Interfaces:
Externalizable,Serializable,Iterable<javax.cache.Cache.Entry<K,V>>,IgniteInternalCache<K,V>
- Direct Known Subclasses:
GridDhtCacheAdapter,GridNearCacheAdapter
public abstract class GridDistributedCacheAdapter<K,V> extends GridCacheAdapter<K,V>
Distributed cache implementation.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridDistributedCacheAdapter.GlobalRemoveAllJob<K,V>Internal job which performs remove all primary key mappings operation on a cache with the given name.-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.AtomicReadRepairEntryProcessor<K,V>, GridCacheAdapter.BulkOperation, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.InvokeAllTimeStatClosure<T>, GridCacheAdapter.PeekModes, GridCacheAdapter.TopologyVersionAwareJob, GridCacheAdapter.UpdateGetAllTimeStatClosure<T>, GridCacheAdapter.UpdateGetAndRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAllConflictTimeStatClosure<T>, GridCacheAdapter.UpdatePutAllTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveAllConflictTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveAllTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure, GridCacheAdapter.UpdateTimeStatClosure<T>
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter
cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, DFLT_CACHE_RETRIES_COUNT, DFLT_CACHE_START_SIZE, DFLT_START_CACHE_SIZE, lastFut, locNodeId, log, map, MAX_RETRIES, metrics, NON_TRANSACTIONAL_IGNITE_CACHE_CLEAR_IN_TX_ERROR_MESSAGE, RET2NULL, txLockMsgLog
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridDistributedCacheAdapter()Empty constructor required byExternalizable.protectedGridDistributedCacheAdapter(GridCacheContext<K,V> ctx)protectedGridDistributedCacheAdapter(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longlocalSizeLong(int part, CachePeekMode[] peekModes)longlocalSizeLong(CachePeekMode[] peekModes)IgniteInternalFuture<Boolean>lockAllAsync(Collection<? extends K> keys, long timeout)All or nothing synchronous lock for passed in keys.protected abstract IgniteInternalFuture<Boolean>lockAllAsync(Collection<KeyCacheObject> keys, long timeout, @Nullable IgniteTxLocalEx tx, boolean isInvalidate, boolean isRead, boolean retval, @Nullable TransactionIsolation isolation, long createTtl, long accessTtl)voidremoveAll()Removes mappings from cache.IgniteInternalFuture<?>removeAllAsync()voidremoveVersionedEntry(KeyCacheObject key, GridCacheVersion ver)StringtoString()IgniteInternalFuture<Boolean>txLockAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isRead, boolean retval, TransactionIsolation isolation, boolean isInvalidate, long createTtl, long accessTtl)-
Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter
active, active, affinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, cache, checkJta, clear, clear, clearAll, clearAllAsync, clearAsync, clearAsync, clearLocally, clearLocally, clearLocally, clearLocallyAll, clusterMetrics, clusterMetrics, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, decrementSize, entries, entryEx, entryEx, entryEx, entrySet, entrySet, evict, evictAll, expiry, expiryPolicy, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPut0, getAndPutAsync, getAndPutAsync, getAndPutAsync0, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemove0, getAndRemoveAsync, getAndRemoveAsync0, getAndReplace, getAndReplaceAsync, getAsync, getAsync, getEntries, getEntriesAsync, getEntry, getEntryAsync, getForcePrimary, getForcePrimaryAsync, igniteIterator, igniteIterator, incrementSize, init, invoke, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isLocal, isLocked, isLockedByThread, isNear, iterator, iterator, keepBinary, keySet, lastAsyncFuture, loadAll, localEntries, localLoad, localLoadCache, localLoadCacheAsync, localMetrics, localPeek, localPreloadPartition, localSize, lock, lockAll, lockAsync, log, lostPartitions, map, metrics0, name, nearSize, nextVersion, nextVersion, offHeapAllocatedSize, offHeapEntriesCount, onDeferredDelete, onKernalStart, onKernalStop, onReconnected, onUndeploy, parsePeekModes, peekEx, peekEx, preloader, preloadPartition, preloadPartitionAsync, primarySize, primarySizeLong, printMemoryStats, put, put, put0, putAll, putAll0, putAllAsync, putAllAsync0, putAllConflict, putAllConflictAsync, putAsync, putAsync, putAsync0, putIfAbsent, putIfAbsentAsync, readExternal, readResolve, rebalance, remove, remove, remove, remove0, removeAll, removeAll0, removeAllAsync, removeAllAsync0, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeAsync0, removeEntry, removeIfObsolete, removeMetrics, repairableGet, repairableGetAll, repairableGetAllAsync, repairableGetAsync, replace, replace, replaceAsync, replaceAsync, scanIterator, setSkipStore, size, size, sizeAsync, sizeLong, sizeLong, sizeLong, sizeLongAsync, sizeLongAsync, skipStore, splitClearLocally, start, startInfo, stop, stopInfo, tx, txStart, txStart, txStartEx, unlock, warnIfUnordered, warnIfUnordered, withExpiryPolicy, withNoRetries, writeExternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.IgniteInternalCache
unlockAll
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GridDistributedCacheAdapter
protected GridDistributedCacheAdapter()
Empty constructor required byExternalizable.
-
GridDistributedCacheAdapter
protected GridDistributedCacheAdapter(GridCacheContext<K,V> ctx)
- Parameters:
ctx- Cache registry.
-
GridDistributedCacheAdapter
protected GridDistributedCacheAdapter(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)
- Parameters:
ctx- Cache context.map- Cache map.
-
-
Method Detail
-
txLockAsync
public IgniteInternalFuture<Boolean> txLockAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isRead, boolean retval, TransactionIsolation isolation, boolean isInvalidate, long createTtl, long accessTtl)
- Specified by:
txLockAsyncin classGridCacheAdapter<K,V>- Parameters:
keys- Keys to lock.timeout- Lock timeout.tx- Transaction.isRead-Truefor read operations.retval- Flag to return value.isolation- Transaction isolation.isInvalidate- Invalidate flag.createTtl- TTL for create operation.accessTtl- TTL for read operation.- Returns:
- Locks future.
-
lockAllAsync
public IgniteInternalFuture<Boolean> lockAllAsync(Collection<? extends K> keys, long timeout)
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.Transactions
Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should useTransactionConcurrency.PESSIMISTICconcurrency control for transaction which will acquire explicit locks for relevant cache operations.- Parameters:
keys- Keys to lock.timeout- Timeout in milliseconds to wait for lock to be acquired ('0'for no expiration).- Returns:
- Future for the collection of locks. The future will return
trueif all filters passed and locks were acquired before timeout has expired,falseotherwise.
-
lockAllAsync
protected abstract IgniteInternalFuture<Boolean> lockAllAsync(Collection<KeyCacheObject> keys, long timeout, @Nullable @Nullable IgniteTxLocalEx tx, boolean isInvalidate, boolean isRead, boolean retval, @Nullable @Nullable TransactionIsolation isolation, long createTtl, long accessTtl)
- Parameters:
keys- Keys to lock.timeout- Timeout.tx- TransactionisInvalidate- Invalidation flag.isRead- Indicates whether value is read or written.retval- Flag to return value.isolation- Transaction isolation.createTtl- TTL for create operation.accessTtl- TTL for read operation.- Returns:
- Future for locks.
-
removeVersionedEntry
public void removeVersionedEntry(KeyCacheObject key, GridCacheVersion ver)
- Parameters:
key- Key to remove.ver- Version to remove.
-
removeAll
public void removeAll() throws IgniteCheckedExceptionRemoves mappings from cache.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
CacheStoreviaIgniteDataStreamer.Transactions
This method is not transactional.- Specified by:
removeAllin interfaceIgniteInternalCache<K,V>- Overrides:
removeAllin classGridCacheAdapter<K,V>- Throws:
IgniteCheckedException- If remove failed.
-
removeAllAsync
public IgniteInternalFuture<?> removeAllAsync()
- Returns:
- Remove future.
-
localSizeLong
public long localSizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException
- Parameters:
peekModes- Peek modes.- Returns:
- Local cache size as a long value.
- Throws:
IgniteCheckedException- If failed.
-
localSizeLong
public long localSizeLong(int part, CachePeekMode[] peekModes) throws IgniteCheckedException- Parameters:
part- partition.peekModes- Peek modes.- Returns:
- Local cache size as a long value.
- Throws:
IgniteCheckedException- If failed.
-
toString
public String toString()
- Overrides:
toStringin classGridCacheAdapter<K,V>
-
-