Class GridDhtColocatedCache<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheAdapter<K,V>
-
- org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter<K,V>
-
- org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter<K,V>
-
- org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter<K,V>
-
- org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache<K,V>
-
- All Implemented Interfaces:
Externalizable,Serializable,Iterable<javax.cache.Cache.Entry<K,V>>,IgniteInternalCache<K,V>
public class GridDhtColocatedCache<K,V> extends GridDhtTransactionalCacheAdapter<K,V>
Colocated cache.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter
GridDhtCacheAdapter.MessageHandler<M>
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter
GridDistributedCacheAdapter.GlobalRemoveAllJob<K,V>
-
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 Constructor Description GridDhtColocatedCache()Empty constructor required forExternalizableGridDhtColocatedCache(GridCacheContext<K,V> ctx)GridDhtColocatedCache(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)Creates colocated cache with specified map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GridDistributedCacheEntryentryExx(KeyCacheObject key, AffinityTopologyVersion topVer, boolean allowDetached)Gets or creates entry for given key and given topology version.IgniteInternalFuture<Map<K,V>>getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, String taskName, boolean deserializeBinary, boolean recovery, ReadRepairStrategy readRepairStrategy, boolean skipVals, boolean needVer)protected IgniteInternalFuture<V>getAsync(K key, boolean forcePrimary, boolean skipTx, String taskName, boolean deserializeBinary, boolean skipVals, boolean needVer)booleanisColocated()booleanisLocked(K key)Checks if any node owns a lock for this key.booleanisLockedByThread(K key)Checks if current thread owns a lock on this key.IgniteInternalFuture<Map<K,V>>loadAsync(@Nullable Collection<KeyCacheObject> keys, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, String taskName, boolean deserializeBinary, boolean recovery, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, @Nullable String txLbl)IgniteInternalFuture<Object>loadAsync(KeyCacheObject key, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, String taskName, boolean deserializeBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, boolean recovery, @Nullable String txLbl)IgniteInternalFuture<Boolean>lockAllAsync(Collection<KeyCacheObject> keys, long timeout, @Nullable IgniteTxLocalEx tx, boolean isInvalidate, boolean isRead, boolean retval, @Nullable TransactionIsolation isolation, long createTtl, long accessTtl)This is an entry point to pessimistic locking within transaction.GridNearTransactionalCache<K,V>near()voidonKernalStart()Kernal start callback.voidremoveLocks(long threadId, GridCacheVersion ver, Collection<KeyCacheObject> keys)Removes locks regardless of whether they are owned or not for given version and keys.voidstart()Starts this cache.StringtoString()voidunlockAll(Collection<? extends K> keys)Unlocks given keys only if current thread owns the locks.-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter
lockAllAsync, lockAllAsyncInternal, removeLocks
-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter
addFuture, createEntry, dumpDebugInfo, entryEx, entryExx, entryExx, getDhtAsync, localEntriesIterator, localLoad, localLoadCache, needRemap, onDeferredDelete, onKernalStop, peekExx, preloader, primarySize, primarySizeLong, printMemoryStats, processForceKeyResponse, processForceKeysRequest, processNearGetRequest, processNearGetResponse, processNearSingleGetRequest, processNearSingleGetResponse, removeFuture, sendTtlUpdateRequest, size, sizeLong, splitClearLocally, topology
-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter
localSizeLong, localSizeLong, lockAllAsync, removeAll, removeAllAsync, removeVersionedEntry, txLockAsync
-
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, entrySet, entrySet, evict, evictAll, expiry, expiryPolicy, get, get, getAll, getAll, getAllAsync, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPut0, getAndPutAsync, getAndPutAsync, getAndPutAsync0, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemove0, getAndRemoveAsync, getAndRemoveAsync0, getAndReplace, getAndReplaceAsync, getAsync, getEntries, getEntriesAsync, getEntry, getEntryAsync, getForcePrimary, getForcePrimaryAsync, igniteIterator, igniteIterator, incrementSize, init, invoke, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isDht, isDhtAtomic, isEmpty, isLocal, isNear, iterator, iterator, keepBinary, keySet, lastAsyncFuture, loadAll, localEntries, localLoadCacheAsync, localMetrics, localPeek, localPreloadPartition, localSize, lock, lockAll, lockAsync, log, lostPartitions, map, metrics0, name, nearSize, nextVersion, nextVersion, offHeapAllocatedSize, offHeapEntriesCount, onReconnected, onUndeploy, parsePeekModes, peekEx, peekEx, preloadPartition, preloadPartitionAsync, 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, sizeAsync, sizeLong, sizeLong, sizeLongAsync, sizeLongAsync, skipStore, 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 java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GridDhtColocatedCache
public GridDhtColocatedCache()
Empty constructor required forExternalizable
-
GridDhtColocatedCache
public GridDhtColocatedCache(GridCacheContext<K,V> ctx)
- Parameters:
ctx- Cache context.
-
GridDhtColocatedCache
public GridDhtColocatedCache(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)
Creates colocated cache with specified map.- Parameters:
ctx- Cache context.map- Cache map.
-
-
Method Detail
-
isColocated
public boolean isColocated()
- Overrides:
isColocatedin classGridCacheAdapter<K,V>- Returns:
Trueif cache is colocated.
-
onKernalStart
public void onKernalStart() throws IgniteCheckedExceptionKernal start callback.- Overrides:
onKernalStartin classGridDhtTransactionalCacheAdapter<K,V>- Throws:
IgniteCheckedException- If callback failed.
-
start
public void start() throws IgniteCheckedExceptionStarts this cache. Child classes should override this method to provide custom start-up behavior.- Specified by:
startin classGridCacheAdapter<K,V>- Throws:
IgniteCheckedException- If start failed.
-
entryExx
public GridDistributedCacheEntry entryExx(KeyCacheObject key, AffinityTopologyVersion topVer, boolean allowDetached)
Gets or creates entry for given key and given topology version.- Parameters:
key- Key for entry.topVer- Topology version.allowDetached- Whether to allow detached entries. Iftrueand node is not primary for given key, a new detached entry will be created. Otherwise, entry will be obtained from dht cache map.- Returns:
- Cache entry.
- Throws:
GridDhtInvalidPartitionException- IfallowDetachedis false and node is not primary for given key.
-
isLocked
public boolean isLocked(K key)
Checks if any node owns a lock for this key.This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
- Specified by:
isLockedin interfaceIgniteInternalCache<K,V>- Overrides:
isLockedin classGridCacheAdapter<K,V>- Parameters:
key- Key to check.- Returns:
Trueif lock is owned by some node.
-
isLockedByThread
public boolean isLockedByThread(K key)
Checks if current thread owns a lock on this key.This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
- Specified by:
isLockedByThreadin interfaceIgniteInternalCache<K,V>- Overrides:
isLockedByThreadin classGridCacheAdapter<K,V>- Parameters:
key- Key to check.- Returns:
Trueif key is locked by current thread.
-
getAsync
protected IgniteInternalFuture<V> getAsync(K key, boolean forcePrimary, boolean skipTx, String taskName, boolean deserializeBinary, boolean skipVals, boolean needVer)
- Overrides:
getAsyncin classGridCacheAdapter<K,V>- Parameters:
key- Key.forcePrimary- Force primary.skipTx- Skip tx.taskName- Task name.deserializeBinary- Deserialize binary.skipVals- Skip values.needVer- Need version.- Returns:
- Future for the get operation.
-
getAllAsync
public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable @Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, String taskName, boolean deserializeBinary, boolean recovery, ReadRepairStrategy readRepairStrategy, boolean skipVals, boolean needVer)
- Overrides:
getAllAsyncin classGridDhtCacheAdapter<K,V>- Parameters:
keys- Keys.forcePrimary- Force primary.skipTx- Skip tx.taskName- Task name.deserializeBinary- Deserialize binary.recovery- Recovery mode flag.skipVals- Skip values.needVer- Need version.- Returns:
- Future for the get operation.
- See Also:
GridCacheAdapter.getAllAsync(Collection)
-
loadAsync
public final IgniteInternalFuture<Object> loadAsync(KeyCacheObject key, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, String taskName, boolean deserializeBinary, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, boolean recovery, @Nullable @Nullable String txLbl)
- Parameters:
key- Key to load.readThrough- Read through flag.forcePrimary- Force get from primary node flag.topVer- Topology version.taskName- Task name.deserializeBinary- Deserialize binary flag.expiryPlc- Expiry policy.skipVals- Skip values flag.needVer- Iftruereturns values as tuples containing value and version.keepCacheObj- Keep cache objects flag.txLbl- Transaction label.- Returns:
- Load future.
-
loadAsync
public final IgniteInternalFuture<Map<K,V>> loadAsync(@Nullable @Nullable Collection<KeyCacheObject> keys, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, String taskName, boolean deserializeBinary, boolean recovery, @Nullable @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, @Nullable @Nullable String txLbl)
- Parameters:
keys- Keys to load.readThrough- Read through flag.forcePrimary- Force get from primary node flag.topVer- Topology version.taskName- Task name.deserializeBinary- Deserialize binary flag.expiryPlc- Expiry policy.skipVals- Skip values flag.needVer- Iftruereturns values as tuples containing value and version.keepCacheObj- Keep cache objects flag.txLbl- Transaction label.- Returns:
- Load future.
-
lockAllAsync
public 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)
This is an entry point to pessimistic locking within transaction.- Overrides:
lockAllAsyncin classGridDhtTransactionalCacheAdapter<K,V>- 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.
-
near
public GridNearTransactionalCache<K,V> near()
- Specified by:
nearin classGridDhtTransactionalCacheAdapter<K,V>- Returns:
- Near cache.
-
unlockAll
public void unlockAll(Collection<? extends K> keys)
Unlocks given keys only if current thread owns the locks. Only the keys that have been locked by calling thread and pass through the filter (if any) will be unlocked. If none of the key locks is owned by current thread, then this method will do nothing.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.- Specified by:
unlockAllin interfaceIgniteInternalCache<K,V>- Overrides:
unlockAllin classGridDhtCacheAdapter<K,V>- Parameters:
keys- Keys to unlock.
-
removeLocks
public void removeLocks(long threadId, GridCacheVersion ver, Collection<KeyCacheObject> keys)Removes locks regardless of whether they are owned or not for given version and keys.- Parameters:
threadId- Thread ID.ver- Lock version.keys- Keys.
-
toString
public String toString()
- Overrides:
toStringin classGridDhtCacheAdapter<K,V>
-
-