org.apache.ignite.internal.processors.cache

## 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.

### Constructor Summary

Constructors
Constructor and Description
`GridCacheSharedContext(GridKernalContext kernalCtx, IgniteTxManager txMgr, GridCacheVersionManager verMgr, GridCacheMvccManager mvccMgr, GridCacheDeploymentManager<K,V> depMgr, GridCachePartitionExchangeManager<K,V> exchMgr, GridCacheIoManager ioMgr, Collection<CacheStoreSessionListener> storeSesLsnrs, CacheJtaManagerAdapter jtaMgr)`

### Method Summary

Methods
`void` `addCacheContext(GridCacheContext cacheCtx)` Adds cache context to shared cache context.
`GridCacheProcessor` `cache()`
`GridCacheContext<K,V>` `cacheContext(int cacheId)` Gets cache context by cache ID.
`Collection<GridCacheContext>` `cacheContexts()` Gets all cache contexts for local node.
`void` `cleanup()` Nulling references to potentially leak-prone objects.
`boolean` `closed(GridCacheContext ctx)` Checks if cache context is closed.
`IgniteInternalFuture<IgniteInternalTx>` `commitTxAsync(IgniteInternalTx tx)`
`byte` `dataCenterId()`
`GridCacheDeploymentManager<K,V>` `deploy()`
`boolean` `deploymentEnabled()`
`GridDiscoveryManager` `discovery()`
`void` `endTx(IgniteInternalTx tx)`
`GridCachePartitionExchangeManager<K,V>` `exchange()`
`IgniteConfiguration` `gridConfig()`
`GridDeploymentManager` `gridDeploy()`
`GridEventStorageManager` `gridEvents()`
`GridIoManager` `gridIO()`
`String` `gridName()`
`GridCacheIoManager` `io()`
`CacheJtaManagerAdapter` `jta()`
`GridKernalContext` `kernalContext()`
`ClusterNode` `localNode()`
`UUID` `localNodeId()`
`IgniteLogger` `logger(Class<?> cls)` Gets grid logger for given class.
`IgniteLogger` `logger(String category)`
`List<GridCacheSharedManager<K,V>>` `managers()`
`Marshaller` `marshaller()`
`GridCacheMvccManager` `mvcc()`
`ClusterNode` `node(UUID nodeId)`
`IgniteInternalFuture<?>` `partitionReleaseFuture(AffinityTopologyVersion topVer)` Waits for partition locks and transactions release.
`IgniteInternalFuture<Object>` `preloadersStartFuture()`
`long` `preloadExchangeTimeout()`
`void` `removeCacheContext(GridCacheContext cacheCtx)`
`void` `resetTxMetrics()` Resets tx metrics.
`IgniteInternalFuture` `rollbackTxAsync(IgniteInternalTx tx)`
`Collection<CacheStoreSessionListener>` `storeSessionListeners()`
`GridTimeoutProcessor` `time()`
`IgniteTxManager` `tm()`
`TransactionConfiguration` `txConfig()` Gets transactions configuration.
`TransactionMetricsAdapter` `txMetrics()`
`String` `verifyTxCompatibility(IgniteInternalTx tx, Iterable<Integer> activeCacheIds, GridCacheContext<K,V> cacheCtx)`
`GridCacheVersionManager` `versions()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GridCacheSharedContext

    public GridCacheSharedContext(GridKernalContext kernalCtx,
                          IgniteTxManager txMgr,
                          GridCacheVersionManager verMgr,
                          GridCacheMvccManager mvccMgr,
                          GridCacheDeploymentManager<K,V> depMgr,
                          GridCachePartitionExchangeManager<K,V> exchMgr,
                          GridCacheIoManager ioMgr,
                          Collection<CacheStoreSessionListener> storeSesLsnrs,
                          CacheJtaManagerAdapter jtaMgr)

Parameters:
  `txMgr` - Transaction manager.
  `verMgr` - Version manager.
  `mvccMgr` - MVCC manager.

### Method Detail

#### 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`

#### removeCacheContext

    public void removeCacheContext(GridCacheContext cacheCtx)

Parameters:
  `cacheCtx` - Cache context to remove.

#### closed

    public boolean closed(GridCacheContext ctx)

Checks if cache context is closed.

Parameters:
  `ctx` - Cache context to check.
Returns:
  `True` if 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.

#### gridName

    public String gridName()

Returns:
  Grid 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 `4` times bigger than network timeout by default.

#### deploymentEnabled

    public boolean deploymentEnabled()

Returns:
  Deployment enabled flag.

#### dataCenterId

    public byte dataCenterId()

Returns:
  Data center ID.

#### preloadersStartFuture

    public IgniteInternalFuture<Object> preloadersStartFuture()

Returns:
  Compound preloaders start future.

#### 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.

#### versions

    public GridCacheVersionManager versions()

Returns:
  Lock order manager.

#### mvcc

    public GridCacheMvccManager mvcc()

Returns:
  Lock manager.

#### io

    public GridCacheIoManager io()

Returns:
  IO 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.

#### localNodeId

    public UUID localNodeId()

Returns:
  Node ID.

#### localNode

    public ClusterNode localNode()

Returns:
  Local node.

#### node

    public ClusterNode node(UUID nodeId)

Parameters:
  `nodeId` - Node ID.
Returns:
  Node or `null`.

#### 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)

Waits for partition locks and transactions release.

Parameters:
  `topVer` - Topology version.
Returns:
  `true` if waiting was successful.

#### verifyTxCompatibility

    @Nullable
    public String verifyTxCompatibility(IgniteInternalTx tx,
                                        Iterable<Integer> activeCacheIds,
                                        GridCacheContext<K,V> cacheCtx)

Parameters:
  `tx` - Transaction to check.
  `activeCacheIds` - Active cache IDs.
  `cacheCtx` - Cache context.
Returns:
  Error message if transactions are incompatible.

#### cleanup

    public void cleanup()

Nulling references to potentially leak-prone objects.

#### endTx

    public void endTx(IgniteInternalTx tx)
               throws IgniteCheckedException

Parameters:
  `tx` - Transaction to close.
Throws:
  `IgniteCheckedException` - If failed.

#### commitTxAsync

    public IgniteInternalFuture<IgniteInternalTx> commitTxAsync(IgniteInternalTx tx)

Parameters:
  `tx` - Transaction to commit.
Returns:
  Commit future.

#### rollbackTxAsync

    public IgniteInternalFuture rollbackTxAsync(IgniteInternalTx tx)
                                         throws IgniteCheckedException

Parameters:
  `tx` - Transaction to rollback.
Returns:
  Rollback future.
Throws:
  `IgniteCheckedException` - If failed.

#### storeSessionListeners

    @Nullable
    public Collection<CacheStoreSessionListener> storeSessionListeners()

Returns:
  Store session listeners.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015