Class GridCacheSharedContext<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheSharedContext<K,V>
-
@GridToStringExclude public class GridCacheSharedContext<K,V> extends Object
Shared context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridCacheSharedContext.BuilderBuilder forGridCacheSharedContext.
-
Method Summary
-
-
-
Method Detail
-
builder
public static GridCacheSharedContext.Builder builder()
- Returns:
- GridCacheSharedContext builder instance.
-
activate
public void activate() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
deactivate
public void deactivate()
-
messageLogger
public IgniteLogger messageLogger()
- Returns:
- Logger.
-
atomicMessageLogger
public IgniteLogger atomicMessageLogger()
- Returns:
- Logger.
-
txPrepareMessageLogger
public IgniteLogger txPrepareMessageLogger()
- Returns:
- Logger.
-
txFinishMessageLogger
public IgniteLogger txFinishMessageLogger()
- Returns:
- Logger.
-
txLockMessageLogger
public IgniteLogger txLockMessageLogger()
- Returns:
- Logger.
-
txRecoveryMessageLogger
public IgniteLogger txRecoveryMessageLogger()
- Returns:
- Logger.
-
isRebalanceEnabled
public boolean isRebalanceEnabled()
- Returns:
- rebalance enabled flag.
-
rebalanceEnabled
public void rebalanceEnabled(boolean rebalanceEnabled)
- Parameters:
rebalanceEnabled- rebalance enabled flag.
-
cacheContexts
public Collection<GridCacheContext> cacheContexts()
Gets all cache contexts for local node.- Returns:
- Collection of all cache contexts.
-
cache
public GridCacheProcessor cache()
- Returns:
- Cache processor.
-
addCacheContext
public void addCacheContext(GridCacheContext cacheCtx) throws IgniteCheckedException
Adds cache context to shared cache context.- Parameters:
cacheCtx- Cache context to add.- Throws:
IgniteCheckedException- If cache ID conflict detected.
-
closed
public boolean closed(GridCacheContext ctx)
Checks if cache context is closed.- Parameters:
ctx- Cache context to check.- Returns:
Trueif cache context is closed.
-
managers
public List<GridCacheSharedManager<K,V>> managers()
- Returns:
- List of shared context managers in starting order.
-
cacheContext
public GridCacheContext<K,V> cacheContext(int cacheId)
Gets cache context by cache ID.- Parameters:
cacheId- Cache ID.- Returns:
- Cache context.
-
cacheObjectContext
@Nullable public @Nullable CacheObjectContext cacheObjectContext(int cacheId) throws IgniteCheckedException
Returns cache object context if created or creates new and caches it until cache started.- Parameters:
cacheId- Cache id.- Throws:
IgniteCheckedException
-
igniteInstanceName
public String igniteInstanceName()
- Returns:
- Ignite instance name.
-
txConfig
public TransactionConfiguration txConfig()
Gets transactions configuration.- Returns:
- Transactions configuration.
-
preloadExchangeTimeout
public long preloadExchangeTimeout()
- Returns:
- Timeout for initial map exchange before preloading. We make it
4times bigger than network timeout by default.
-
deploymentEnabled
public boolean deploymentEnabled()
- Returns:
- Deployment enabled flag.
-
dataCenterId
public byte dataCenterId()
- Returns:
- Data center ID.
-
txMetrics
public TransactionMetricsAdapter txMetrics()
- Returns:
- Transactional metrics adapter.
-
resetTxMetrics
public void resetTxMetrics()
Resets tx metrics.
-
tm
public IgniteTxManager tm()
- Returns:
- Cache transaction manager.
-
jta
public CacheJtaManagerAdapter jta()
- Returns:
- JTA manager.
-
exchange
public GridCachePartitionExchangeManager<K,V> exchange()
- Returns:
- Exchange manager.
-
affinity
public CacheAffinitySharedManager<K,V> affinity()
- Returns:
- Affinity manager.
-
versions
public GridCacheVersionManager versions()
- Returns:
- Lock order manager.
-
mvcc
public GridCacheMvccManager mvcc()
- Returns:
- Lock manager.
-
database
public IgniteCacheDatabaseSharedManager database()
- Returns:
- Database manager.
-
pageStore
@Nullable public @Nullable IgnitePageStoreManager pageStore()
- Returns:
- Page store manager.
Nullif persistence is not enabled.
-
snapshotMgr
public IgniteSnapshotManager snapshotMgr()
- Returns:
- Page storage snapshot manager.
-
wal
@Nullable public @Nullable IgniteWriteAheadLogManager wal()
- Returns:
- Write ahead log manager.
-
wal
@Nullable public @Nullable IgniteWriteAheadLogManager wal(boolean forCdc)
- Parameters:
forCdc- Iftruethen wal queried to log CDC related stuff.- Returns:
- Write ahead log manager.
-
cdc
public CdcManager cdc()
- Returns:
- CDC manager.
-
walState
public WalStateManager walState()
- Returns:
- WAL state manager.
-
io
public GridCacheIoManager io()
- Returns:
- IO manager.
-
ttl
public GridCacheSharedTtlCleanupManager ttl()
- Returns:
- Ttl cleanup manager.
-
deploy
public GridCacheDeploymentManager<K,V> deploy()
- Returns:
- Cache deployment manager.
-
marshaller
public Marshaller marshaller()
- Returns:
- Marshaller.
-
gridConfig
public IgniteConfiguration gridConfig()
- Returns:
- Grid configuration.
-
kernalContext
public GridKernalContext kernalContext()
- Returns:
- Kernal context.
-
gridIO
public GridIoManager gridIO()
- Returns:
- Grid IO manager.
-
gridDeploy
public GridDeploymentManager gridDeploy()
- Returns:
- Grid deployment manager.
-
gridEvents
public GridEventStorageManager gridEvents()
- Returns:
- Grid event storage manager.
-
discovery
public GridDiscoveryManager discovery()
- Returns:
- Discovery manager.
-
time
public GridTimeoutProcessor time()
- Returns:
- Timeout processor.
-
evict
public PartitionsEvictManager evict()
- Returns:
- Partition evict manager.
-
diagnostic
public CacheDiagnosticManager diagnostic()
- Returns:
- Diagnostic manager.
-
localNodeId
public UUID localNodeId()
- Returns:
- Node ID.
-
localNode
public ClusterNode localNode()
- Returns:
- Local node.
-
getLocalStoreCount
public int getLocalStoreCount()
- Returns:
- Count of caches with configured local stores.
-
node
@Nullable public @Nullable ClusterNode node(UUID nodeId)
- Parameters:
nodeId- Node ID.- Returns:
- Node or
null.
-
localStorePrimaryOnly
public boolean localStorePrimaryOnly()
Indicating whether local store keeps primary only.
-
logger
public IgniteLogger logger(Class<?> cls)
Gets grid logger for given class.- Parameters:
cls- Class to get logger for.- Returns:
- IgniteLogger instance.
-
logger
public IgniteLogger logger(String category)
- Parameters:
category- Category.- Returns:
- Logger.
-
partitionReleaseFuture
public IgniteInternalFuture<?> partitionReleaseFuture(AffinityTopologyVersion topVer)
Captures all ongoing operations that we need to wait before we can proceed to the next topology version. This method must be called only afterGridDhtPartitionTopology.updateTopologyVersion(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture, org.apache.ignite.internal.managers.discovery.DiscoCache, long, boolean)method is called so that all new updates will wait to switch to the new version. This method will capture:- All non-released cache locks
- All non-committed transactions (local and remote)
- All pending atomic updates
- All pending DataStreamer updates
- Parameters:
topVer- Topology version.- Returns:
trueif waiting was successful.
-
partitionRecoveryFuture
public IgniteInternalFuture<?> partitionRecoveryFuture(AffinityTopologyVersion topVer, ClusterNode node)
Captures all prepared operations that we need to wait before we able to perform PME-free switch. This method must be called only afterGridDhtPartitionTopology.updateTopologyVersion(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture, org.apache.ignite.internal.managers.discovery.DiscoCache, long, boolean)method is called so that all new updates will wait to switch to the new version. Captured updates are wrapped in a future that will be completed once pending objects are released.- Parameters:
topVer- Topology version.node- Failed node.- Returns:
trueif waiting was successful.
-
nextAffinityReadyFuture
public IgniteInternalFuture<?> nextAffinityReadyFuture(AffinityTopologyVersion curVer)
Gets ready future for the next affinity topology version (used in cases when a node leaves grid).- Parameters:
curVer- Current topology version (before a node left grid).- Returns:
- Ready future.
-
verifyTxCompatibility
@Nullable public @Nullable String verifyTxCompatibility(IgniteInternalTx tx, GridIntList activeCacheIds, GridCacheContext<K,V> cacheCtx)
- Parameters:
tx- Transaction to check.activeCacheIds- Active cache IDs.cacheCtx- Cache context.- Returns:
- Error message if transactions are incompatible.
-
lockedTopologyVersion
@Nullable public @Nullable AffinityTopologyVersion lockedTopologyVersion(IgniteInternalTx ignore)
- Parameters:
ignore- Transaction to ignore.- Returns:
- Not null topology version if current thread holds lock preventing topology change.
-
cleanup
public void cleanup()
Nulling references to potentially leak-prone objects.
-
endTx
public void endTx(GridNearTxLocal tx) throws IgniteCheckedException
- Parameters:
tx- Transaction to close.- Throws:
IgniteCheckedException- If failed.
-
commitTxAsync
public IgniteInternalFuture<IgniteInternalTx> commitTxAsync(GridNearTxLocal tx)
- Parameters:
tx- Transaction to commit.- Returns:
- Commit future.
-
rollbackTxAsync
public IgniteInternalFuture rollbackTxAsync(GridNearTxLocal tx)
- Parameters:
tx- Transaction to rollback.- Returns:
- Rollback future.
-
suspendTx
public void suspendTx(GridNearTxLocal tx) throws IgniteCheckedException
Suspends transaction. It could be resume later.- Parameters:
tx- Transaction to suspend.- Throws:
IgniteCheckedException- If suspension failed.
-
resumeTx
public void resumeTx(GridNearTxLocal tx) throws IgniteCheckedException
Resume transaction if it was previously suspended.- Parameters:
tx- Transaction to resume.- Throws:
IgniteCheckedException- If resume failed.
-
storeSessionListeners
@Nullable public @Nullable Collection<CacheStoreSessionListener> storeSessionListeners()
- Returns:
- Store session listeners.
-
txContextReset
public void txContextReset()
Reset thread-local context for transactional cache.
-
startDhtAtomicUpdate
public int startDhtAtomicUpdate(GridCacheVersion ver)
- Parameters:
ver- DHT atomic update future version.- Returns:
- Amount of active DHT atomic updates.
-
finishDhtAtomicUpdate
public void finishDhtAtomicUpdate(GridCacheVersion ver)
- Parameters:
ver- DHT atomic update future version.
-
readOnlyMode
public boolean readOnlyMode()
- Returns:
trueif cluster is in read-only mode.
-
readOnlyMode
public void readOnlyMode(boolean readOnlyMode)
- Parameters:
readOnlyMode- Read-only flag.
-
setTxManager
public void setTxManager(IgniteTxManager txMgr)
For test purposes.- Parameters:
txMgr- Tx manager.
-
isLazyMemoryAllocation
public boolean isLazyMemoryAllocation(@Nullable @Nullable DataRegion region)- Returns:
Trueif lazy memory allocation enabled.Falseotherwise.
-
-