@GridToStringExclude public class GridCacheContext<K,V> extends Object implements Externalizable
| Constructor and Description |
|---|
GridCacheContext()
Empty constructor required for
Externalizable. |
GridCacheContext(GridKernalContext ctx,
GridCacheSharedContext sharedCtx,
CacheConfiguration cacheCfg,
CacheType cacheType,
boolean affNode,
boolean updatesAllowed,
GridCacheEventManager evtMgr,
GridCacheSwapManager swapMgr,
CacheStoreManager storeMgr,
GridCacheEvictionManager evictMgr,
GridCacheQueryManager<K,V> qryMgr,
CacheContinuousQueryManager contQryMgr,
GridCacheAffinityManager affMgr,
CacheDataStructuresManager dataStructuresMgr,
GridCacheTtlManager ttlMgr,
GridCacheDrManager drMgr,
CacheJtaManagerAdapter jtaMgr,
CacheConflictResolutionManager<K,V> rslvrMgr,
CachePluginManager pluginMgr) |
public GridCacheContext()
Externalizable.public GridCacheContext(GridKernalContext ctx, GridCacheSharedContext sharedCtx, CacheConfiguration cacheCfg, CacheType cacheType, boolean affNode, boolean updatesAllowed, GridCacheEventManager evtMgr, GridCacheSwapManager swapMgr, CacheStoreManager storeMgr, GridCacheEvictionManager evictMgr, GridCacheQueryManager<K,V> qryMgr, CacheContinuousQueryManager contQryMgr, GridCacheAffinityManager affMgr, CacheDataStructuresManager dataStructuresMgr, GridCacheTtlManager ttlMgr, GridCacheDrManager drMgr, CacheJtaManagerAdapter jtaMgr, CacheConflictResolutionManager<K,V> rslvrMgr, CachePluginManager pluginMgr)
ctx - Kernal context.sharedCtx - Cache shared context.cacheCfg - Cache configuration.cacheType - Cache type.affNode - True if local node is affinity node.updatesAllowed - Updates allowed flag.evtMgr - Cache event manager.swapMgr - Cache swap manager.storeMgr - Store manager.evictMgr - Cache eviction manager.qryMgr - Cache query manager.contQryMgr - Continuous query manager.affMgr - Affinity manager.dataStructuresMgr - Cache dataStructures manager.ttlMgr - TTL manager.drMgr - Data center replication manager.jtaMgr - JTA manager.rslvrMgr - Conflict resolution manager.pluginMgr - Cache plugin manager.public IgniteUuid dynamicDeploymentId()
public boolean affinityNode()
True if local node is affinity node.public void awaitStarted()
throws IgniteCheckedException
IgniteCheckedException - If failed to wait.public boolean started()
public void onStarted()
public AffinityTopologyVersion startTopologyVersion()
public void startTopologyVersion(AffinityTopologyVersion startTopVer)
startTopVer - Start topology version.@Nullable public javax.cache.expiry.ExpiryPolicy expiry()
ExpiryPolicy.@Nullable public javax.cache.expiry.ExpiryPolicy expiryForTxEntry(IgniteTxEntry txEntry)
txEntry - TX entry.public List<GridCacheManager<K,V>> managers()
public GridCacheSharedContext<K,V> shared()
public int cacheId()
public boolean systemTx()
True if should use system transactions which are isolated from user transactions.public boolean userCache()
True if cache created by user.public GridIoPolicy ioPolicy()
public void cache(GridCacheAdapter<K,V> cache)
cache - Cache.public GridLocalCache<K,V> local()
public boolean isDht()
True if cache is DHT.public boolean isDhtAtomic()
True if cache is DHT atomic.public boolean isColocated()
True if cache is colocated (dht with near disabled).public boolean isNear()
True if cache is near cache.public boolean isLocal()
True if cache is local.public boolean isReplicated()
True if cache is replicated cache.public boolean isDrEnabled()
True in case replication is enabled.public boolean deferredDelete()
True if entries should not be deleted from cache immediately.public void incrementPublicSize(GridCacheMapEntry e)
e - Entry.public void decrementPublicSize(GridCacheMapEntry e)
e - Entry.public GridDhtCacheAdapter<K,V> dht()
public GridDhtTransactionalCacheAdapter<K,V> dhtTx()
public GridDhtColocatedCache<K,V> colocated()
public GridNearCacheAdapter<K,V> near()
public GridNearTransactionalCache<K,V> nearTx()
public GridCacheGateway<K,V> gate()
@Nullable public GridUnsafeMemory unsafeMemory()
GridUnsafeMemory object.public GridKernalContext kernalContext()
public IgniteEx grid()
public String gridName()
public String name()
public String namex()
public String namexx()
'default'.'default'.public IgniteTxKey txKey(KeyCacheObject key)
key - Key to construct tx key for.public void checkSecurity(SecurityPermission op) throws SecurityException
op - Operation to check.SecurityException - If security check failed.public GridCachePreloader preloader()
public UUID nodeId()
public boolean rebalanceEnabled()
True if rebalance is enabled.public boolean atomic()
True if atomic.public boolean transactional()
True if transactional.public ClusterNode localNode()
public UUID localNodeId()
public boolean isLocalNode(ClusterNode n)
n - Node to check.True if node is local.public boolean isLocalNode(UUID id)
id - Node ID to check.True if node ID is local.@Nullable public ClusterNode node(UUID nodeId)
nodeId - Node id.public GridDhtPartitionTopology topology()
public GridDhtTopologyFuture topologyVersionFuture()
public Marshaller marshaller()
public IgniteLogger logger(String ctgr)
ctgr - Category to log.public IgniteLogger logger(Class<?> cls)
cls - Class to log.public IgniteConfiguration gridConfig()
public GridIoManager gridIO()
public GridTimeoutProcessor time()
public GridOffHeapProcessor offheap()
public GridDeploymentManager gridDeploy()
public GridSwapSpaceManager gridSwap()
public GridEventStorageManager gridEvents()
public GridClosureProcessor closures()
public GridDiscoveryManager discovery()
public GridCacheAdapter<K,V> cache()
public CacheConfiguration config()
public boolean writeToStoreFromDht()
True If store writes should be performed from dht transactions. This happens if both
writeBehindEnabled and writeBehindPreferPrimary cache configuration properties
are set to true or the store is local.public IgniteTxManager tm()
public GridCacheVersionManager versions()
public GridCacheMvccManager mvcc()
public GridCacheEventManager events()
public GridCacheAffinityManager affinity()
public GridCacheQueryManager<K,V> queries()
null if disabled.public CacheContinuousQueryManager continuousQueries()
null if disabled.public CacheWeakQueryIteratorsHolder<Map.Entry<K,V>> itHolder()
public GridCacheSwapManager swap()
public CacheStoreManager store()
public GridCacheDeploymentManager<K,V> deploy()
public GridCacheIoManager io()
public GridCacheEvictionManager evicts()
public CacheDataStructuresManager dataStructures()
public GridCacheDrManager dr()
public GridCacheTtlManager ttl()
public CacheJtaManagerAdapter jta()
public CachePluginManager plugin()
public boolean putIfAbsentFilter(@Nullable CacheEntryPredicate[] p)
p - Predicate.True if given predicate is filter for putIfAbsent operation.public CacheEntryPredicate[] noValArray()
public CacheEntryPredicate[] hasValArray()
public CacheEntryPredicate[] equalsValArray(V val)
val - Value to check.public CacheEntryPredicate equalsValue(V val)
val - Value to check.public GridCacheVersion[] emptyVersion()
public AffinityKeyMapper defaultAffMapper()
public void cacheObjectContext(CacheObjectContext cacheObjCtx)
cacheObjCtx - Cache object context.public IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] vararg(IgnitePredicate<javax.cache.Cache.Entry<K,V>> p)
p - Single predicate.public <K1,V1> boolean isAll(GridCacheEntryEx e, @Nullable IgnitePredicate<javax.cache.Cache.Entry<K1,V1>>[] p) throws IgniteCheckedException
GridFunc.isAll(Object, IgnitePredicate[]), but safely unwraps exceptions.e - Element.p - Predicates.True if predicates passed.IgniteCheckedException - If failed.public <E> boolean isAll(E e,
@Nullable
IgnitePredicate<? super E>[] p)
throws IgniteCheckedException
GridFunc.isAll(Object, IgnitePredicate[]), but safely unwraps exceptions.E - Element type.e - Element.p - Predicates.True if predicates passed.IgniteCheckedException - If failed.public boolean isAll(GridCacheEntryEx e, CacheEntryPredicate[] p) throws IgniteCheckedException
e - Entry.p - Predicates.True if predicates passed.IgniteCheckedException - If failed.public boolean isAllLocked(GridCacheEntryEx e, CacheEntryPredicate[] p) throws IgniteCheckedException
e - Entry.p - Predicates.True if predicates passed.IgniteCheckedException - If failed.public void operationContextPerCall(@Nullable CacheOperationContext opCtx)
opCtx - Flags to set.public CacheOperationContext operationContextPerCall()
public UUID subjectIdPerCall(@Nullable UUID subjId)
subjId - Optional already existing subject ID.public UUID subjectIdPerCall(@Nullable UUID subjId, @Nullable CacheOperationContext opCtx)
subjId - Optional already existing subject ID.opCtx - Optional thread local operation context.public boolean skipStore()
true if the skip store flag is set.public Runnable projectSafe(Runnable r)
r - Runnable.public <T> Callable<T> projectSafe(Callable<T> r)
r - Callable.public boolean deploymentEnabled()
True if deployment enabled.public boolean isSwapOrOffheapEnabled()
True if swap store of off-heap cache are enabled.public boolean isOffHeapEnabled()
True if offheap storage is enabled.public boolean readThrough()
True if store read-through mode is enabled.public boolean loadPreviousValue()
True if store read-through mode is enabled.public boolean writeThrough()
True if store write-through is enabled.public boolean isInvalidate()
True if invalidation is enabled.public boolean syncCommit()
True if synchronous commit is enabled.public boolean syncRollback()
True if synchronous rollback is enabled.public boolean syncPrimary()
True if only primary node should be updated synchronously.public boolean dhtMap(UUID nearNodeId, AffinityTopologyVersion topVer, GridDhtCacheEntry entry, GridCacheVersion explicitLockVer, IgniteLogger log, Map<ClusterNode,List<GridDhtCacheEntry>> dhtMap, @Nullable Map<ClusterNode,List<GridDhtCacheEntry>> nearMap) throws GridCacheEntryRemovedException
nearNodeId - Near node ID.topVer - Topology version.entry - Entry.log - Log.dhtMap - Dht mappings.nearMap - Near mappings.True if mapped.GridCacheEntryRemovedException - If reader for entry is removed.public boolean dhtMap(GridDhtCacheEntry entry, GridCacheVersion explicitLockVer, IgniteLogger log, Map<ClusterNode,List<GridDhtCacheEntry>> dhtMap, Map<ClusterNode,List<GridDhtCacheEntry>> nearMap) throws GridCacheEntryRemovedException
entry - Entry.log - Log.dhtMap - Dht mappings.nearMap - Near mappings.True if mapped.GridCacheEntryRemovedException - If reader for entry is removed.public boolean hasKey(Iterable<? extends K> keys, Collection<Integer> movingParts)
keys - Collection of keys to check.movingParts - Collection of partitions to check against.True if there exist a key in collection keys that belongs
to one of partitions in movingPartspublic boolean conflictNeedResolve()
True in case DR is required.public GridCacheVersionConflictContext<K,V> conflictResolve(GridCacheVersionedEntryEx<K,V> oldEntry, GridCacheVersionedEntryEx<K,V> newEntry, boolean atomicVerComp) throws IgniteCheckedException
oldEntry - Old entry.newEntry - New entry.atomicVerComp - Whether to use atomic version comparator.IgniteCheckedException - In case of exception.public byte dataCenterId()
public void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)
entry - Entry.ver - Version.public boolean cancelRemove(@Nullable IgniteBiTuple<Boolean,?> interceptorRes)
interceptorRes - Result of CacheInterceptor.onBeforeRemove(javax.cache.Cache.Entry<K, V>) callback.True if interceptor cancels remove.public IgniteCacheObjectProcessor cacheObjects()
public boolean keepPortable()
public boolean offheapTiered()
True if OFFHEAP_TIERED memory mode is enabled.public boolean useOffheapEntry()
True if should use entry with offheap value pointer.@Nullable public <T> T unwrapTemporary(@Nullable Object obj)
obj - Object.public Collection<Object> unwrapPortablesIfNeeded(Collection<Object> col, boolean keepPortable)
col - Collection to unwrap.keepPortable - Keep portable flag.public Object unwrapPortableIfNeeded(Object o, boolean keepPortable)
o - Object to unwrap.keepPortable - Keep portable flag.public CacheObjectContext cacheObjectContext()
@Nullable public CacheObject toCacheObject(@Nullable Object obj)
obj - Object.public KeyCacheObject toCacheKeyObject(Object obj)
obj - Object.public KeyCacheObject toCacheKeyObject(byte[] bytes) throws IgniteCheckedException
bytes - Bytes.IgniteCheckedException - If failed.@Nullable public CacheObject unswapCacheObject(byte type, byte[] bytes, @Nullable IgniteUuid clsLdrId) throws IgniteCheckedException
type - Type.bytes - Bytes.clsLdrId - Class loader ID.IgniteCheckedException - If failed.public CacheObject fromOffheap(long valPtr, boolean tmp) throws IgniteCheckedException
valPtr - Value pointer.tmp - If true can return temporary instance which is valid while entry lock is held.IgniteCheckedException - If failed.public <K1,V1> void addResult(Map<K1,V1> map, KeyCacheObject key, CacheObject val, boolean skipVals, boolean keepCacheObjects, boolean deserializePortable, boolean cpy)
map - Map.key - Key.val - Value.skipVals - Skip values flag.keepCacheObjects - Keep cache objects flag.deserializePortable - Deserialize portable flag.cpy - Copy flag.public boolean updatesAllowed()
public void cleanup()
public void printMemoryStats()
public Collection<KeyCacheObject> cacheKeysView(Collection<?> keys)
keys - Keys.public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionprotected Object readResolve() throws ObjectStreamException
ObjectStreamException - Thrown in case of unmarshalling error.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.2.0-incubating Release Date : June 16 2015