org.apache.ignite.internal.processors.cache

## Class GridCacheProcessor

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter
  - - org.apache.ignite.internal.processors.cache.GridCacheProcessor

All Implemented Interfaces:
  GridComponent, MetastorageLifecycleListener, GridProcessor

    public class GridCacheProcessor
    extends GridProcessorAdapter
    implements MetastorageLifecycleListener

Cache processor.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheProcessor(GridKernalContext ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addCacheConfiguration(CacheConfiguration cacheCfg)`
`IgniteCacheProxyImpl<?,?>` `addjCacheProxy(String name, IgniteCacheProxyImpl<?,?> proxy)`
`void` `awaitStarted()`
`void` `blockGateways()` Blocks all available gateways
`<K,V> IgniteInternalCache<K,V>` `cache(String name)`
`CacheConfiguration` `cacheConfiguration(String name)` Get configuration for the given cache.
`DynamicCacheDescriptor` `cacheDescriptor(int cacheId)`
`DynamicCacheDescriptor` `cacheDescriptor(String name)` Get registered cache descriptor.
`Map<String,DynamicCacheDescriptor>` `cacheDescriptors()`
`CacheGroupContext` `cacheGroup(int grpId)`
`Map<Integer,CacheGroupDescriptor>` `cacheGroupDescriptors()`
`Collection<CacheGroupContext>` `cacheGroups()`
`CacheMode` `cacheMode(String cacheName)` Gets cache mode.
`Collection<String>` `cacheNames()` Gets a collection of currently started caches.
`Collection<IgniteInternalCache<?,?>>` `caches()`
`CacheType` `cacheType(String cacheName)`
`IgniteInternalFuture<Boolean>` `changeWalMode(Collection<String> cacheNames, boolean enabled)` Change WAL mode.
`void` `checkEmptyTransactions()` Method checks that current thread does not have active transactions.
`void` `cleanupCachesDirectories()` Remove all persistent files for all registered caches.
`void` `clearStatistics(Collection<String> cacheNames)` Clear statistics globally for the caches
`<T> T` `clone(T obj)`
`void` `collectGridNodeData(DiscoveryDataBag dataBag)` Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.
`void` `collectJoiningNodeData(DiscoveryDataBag dataBag)` Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.
`void` `completeProxyInitialize(String name)`
`void` `completeProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, AffinityTopologyVersion initVer, AffinityTopologyVersion doneVer)`
`<K,V> GridCacheSharedContext<K,V>` `context()`
`IgniteInternalFuture<?>` `createFromTemplate(String cacheName)` Dynamically starts cache using template configuration.
`void` `createMissingQueryCaches()` Starts client caches that do not exist yet.
`DynamicCacheChangeRequest` `createStopRequest(String cacheName, boolean restart, boolean destroy)` Prepares cache stop request.
`GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`IgniteInternalFuture<?>` `dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)` Starts cache stop request as cache change batch.
`IgniteInternalFuture<Boolean>` `dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart)`
`IgniteInternalFuture<?>` `dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean restart)`
`IgniteInternalFuture<?>` `dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean restart, boolean destroy)`
`IgniteInternalFuture<Boolean>` `dynamicStartCache(CacheConfiguration ccfg, String cacheName, NearCacheConfiguration nearCfg, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)` Dynamically starts cache.
`IgniteInternalFuture<Boolean>` `dynamicStartCache(CacheConfiguration ccfg, String cacheName, NearCacheConfiguration nearCfg, CacheType cacheType, boolean sql, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)` Dynamically starts cache.
`IgniteInternalFuture<Boolean>` `dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart)` Dynamically starts multiple caches.
`IgniteInternalFuture<Boolean>` `dynamicStartCachesByStoredConf(Collection<StoredCacheData> storedCacheDataList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart)` Dynamically starts multiple caches.
`IgniteInternalFuture<Boolean>` `dynamicStartSqlCache(CacheConfiguration ccfg)` Dynamically starts cache as a result of SQL `CREATE TABLE` command.
`void` `enableRebalance()` Start cache rebalance.
`void` `enableStatistics(Collection<String> cacheNames, boolean enabled)` Enable/disable statistics globally for the caches
`CachePartitionExchangeWorkerTask` `exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)` Create exchange worker task for custom discovery message.
`CacheConfiguration` `getConfigFromTemplate(String cacheName)`
`IgniteInternalFuture<?>` `getOrCreateFromTemplate(String cacheName, boolean checkThreadTx)` Dynamically starts cache using template configuration.
`IgniteInternalFuture<?>` `getOrCreateFromTemplate(String cacheName, String templateName, CacheConfigurationOverride cfgOverride, boolean checkThreadTx)` Dynamically starts cache using template configuration.
`<K,V> IgniteInternalCache<K,V>` `getOrStartCache(String name)`
`<K,V> IgniteInternalCache<K,V>` `getOrStartCache(String name, CacheConfiguration ccfg)`
`IgniteCacheProxy<?,?>` `getOrStartPublicCache(boolean start, boolean inclLoc)` Gets public cache that can be used for query execution.
`<K,V> GridCacheAdapter<K,V>` `internalCache(String name)`
`Collection<GridCacheAdapter<?,?>>` `internalCaches()`
`<K,V> IgniteCacheProxy<K,V>` `jcache(String name)`
`IgniteCacheProxyImpl<?,?>` `jcacheProxy(String name, boolean awaitInit)`
`Collection<IgniteCacheProxy<?,?>>` `jcaches()`
`long` `lastDataVersion()`
`LocalJoinCachesContext` `localJoinCachesContext()`
`void` `onCacheStatisticsModeChange(CacheStatisticsModeChangeMessage msg)` Cache statistics flag change message received.
`boolean` `onCustomEvent(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer, ClusterNode node)` Callback invoked from discovery thread when discovery custom message is received.
`void` `onDisconnected(IgniteFuture<?> reconnectFut)` Client disconnected callback.
`void` `onDiscoveryEvent(int type, DiscoveryCustomMessage customMsg, ClusterNode node, AffinityTopologyVersion topVer, DiscoveryDataClusterState state)`
`void` `onExchangeDone(AffinityTopologyVersion cacheStartVer, ExchangeActions exchActions, Throwable err)` Callback invoked when first exchange future for dynamic cache is completed.
`void` `onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)` Receives discovery data object from remote nodes (called on new node during discovery process).
`void` `onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)` Method is called on nodes that are already in grid (not on joining node).
`void` `onKernalStart(boolean active)` Callback that notifies that kernal has successfully started, including all managers and processors.
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`void` `onKernalStopCaches(boolean cancel)`
`void` `onReadyForRead(ReadOnlyMetastorage metastorage)` Is called when metastorage is made ready for read-only operations very early on node startup phase.
`void` `onReadyForReadWrite(ReadWriteMetastorage metastorage)` Fully functional metastore capable of performing reading and writing operations.
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`void` `onStateChangeFinish(ChangeGlobalStateFinishMessage msg)`
`ExchangeActions` `onStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer, DiscoveryDataClusterState curState)`
`void` `onTxTimeoutOnPartitionMapExchangeChange(TxTimeoutOnPartitionMapExchangeChangeMessage msg)` Callback invoked from discovery thread when discovery custom message is received.
`void` `onUndeployed(ClassLoader ldr)` Callback invoked by deployment manager for whenever a class loader gets undeployed.
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`void` `processStatisticsModeChange(CacheStatisticsModeChangeMessage msg)` Cache statistics flag change task processed by exchange worker.
`void` `processTxTimeoutOnPartitionMapExchangeChange(TxTimeoutOnPartitionMapExchangeChangeMessage msg)` The task for changing transaction timeout on partition map exchange processed by exchange worker.
`Collection<String>` `publicAndDsCacheNames()` Gets a collection of currently started public cache names.
`<K,V> IgniteInternalCache<K,V>` `publicCache(String name)`
`Collection<String>` `publicCacheNames()` Gets a collection of currently started public cache names.
`Collection<IgniteCacheProxy<?,?>>` `publicCaches()`
`<K,V> IgniteCacheProxy<K,V>` `publicJCache(String cacheName)`
`<K,V> IgniteCacheProxy<K,V>` `publicJCache(String cacheName, boolean failIfNotStarted, boolean checkThreadTx)`
`void` `registrateProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, GridFutureAdapter<?> fut)`
`IgniteInternalFuture<?>` `resetCacheState(Collection<String> cacheNames)` Resets cache state after the cache has been moved to recovery state.
`void` `resetRestartingCaches()` Reset restarting caches.
`void` `restartProxies()` Restarts proxies of caches if they was marked as restarting.
`void` `saveCacheConfiguration(DynamicCacheDescriptor desc)` Save cache configuration to persistent store if necessary.
`void` `setTxTimeoutOnPartitionMapExchange(long timeout)` Sets transaction timeout on partition map exchange.
`void` `start()` Starts grid component.
`IgniteInternalFuture<?>` `startCachesOnLocalJoin(AffinityTopologyVersion exchTopVer, LocalJoinCachesContext locJoinCtx)`
`Collection<DynamicCacheDescriptor>` `startReceivedCaches(UUID nodeId, AffinityTopologyVersion exchTopVer)` Starts statically configured caches received from remote nodes during exchange.
`void` `stop(boolean cancel)` Stops grid component.
`void` `stopCaches(boolean cancel)`
`boolean` `systemCache(String name)`
`IgniteTransactionsEx` `transactions()`
`<K,V> IgniteInternalCache<K,V>` `utilityCache()` Gets utility cache.
`IgniteNodeValidationResult` `validateNode(ClusterNode node)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
`IgniteNodeValidationResult` `validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)`
`boolean` `walEnabled(String cacheName)`

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, toString`

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

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

### Constructor Detail

#### GridCacheProcessor

    public GridCacheProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### enableRebalance

    public void enableRebalance()

Start cache rebalance.

#### exchangeTaskForCustomDiscoveryMessage

    public CachePartitionExchangeWorkerTask exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)

Create exchange worker task for custom discovery message.

Parameters:
  `msg` - Custom discovery message.
Returns:
  Task or `null` if message doesn't require any special processing.

#### onReadyForRead

    public void onReadyForRead(ReadOnlyMetastorage metastorage)
                        throws IgniteCheckedException

Is called when metastorage is made ready for read-only operations very early on node startup phase. Reference for read-only metastorage should be used only within this method and shouldn't be stored to any field.

Specified by:
  `onReadyForRead` in interface `MetastorageLifecycleListener`
Parameters:
  `metastorage` - Read-only meta storage.
Throws:
  `IgniteCheckedException`

#### onReadyForReadWrite

    public void onReadyForReadWrite(ReadWriteMetastorage metastorage)
                             throws IgniteCheckedException

Fully functional metastore capable of performing reading and writing operations. Components interested in using metastore are allowed to keep reference passed into the method in their fields.

Specified by:
  `onReadyForReadWrite` in interface `MetastorageLifecycleListener`
Parameters:
  `metastorage` - Fully functional meta storage.
Throws:
  `IgniteCheckedException`

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### cacheGroup

    @Nullable
    public CacheGroupContext cacheGroup(int grpId)

Parameters:
  `grpId` - Group ID.
Returns:
  Cache group.

#### cacheGroups

    public Collection<CacheGroupContext> cacheGroups()

Returns:
  Cache groups.

#### onKernalStart

    public void onKernalStart(boolean active)
                       throws IgniteCheckedException

Callback that notifies that kernal has successfully started, including all managers and processors.

Specified by:
  `onKernalStart` in interface `GridComponent`
Overrides:
  `onKernalStart` in class `GridProcessorAdapter`
Parameters:
  `active` - Cluster active flag (note: should be used carefully since state can change concurrently).
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

Specified by:
  `stop` in interface `GridComponent`
Overrides:
  `stop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### stopCaches

    public void stopCaches(boolean cancel)

Parameters:
  `cancel` - Cancel.

#### blockGateways

    public void blockGateways()

Blocks all available gateways

#### onKernalStop

    public void onKernalStop(boolean cancel)

Callback to notify that kernal is about to stop.

Specified by:
  `onKernalStop` in interface `GridComponent`
Overrides:
  `onKernalStop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

#### onKernalStopCaches

    public void onKernalStopCaches(boolean cancel)

Parameters:
  `cancel` - Cancel.

#### onDisconnected

    public void onDisconnected(IgniteFuture<?> reconnectFut)
                        throws IgniteCheckedException

Client disconnected callback.

Specified by:
  `onDisconnected` in interface `GridComponent`
Overrides:
  `onDisconnected` in class `GridProcessorAdapter`
Parameters:
  `reconnectFut` - Reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### onReconnected

    public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
                                          throws IgniteCheckedException

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridComponent`
Overrides:
  `onReconnected` in class `GridProcessorAdapter`
Parameters:
  `clusterRestarted` - Cluster restarted flag.
Returns:
  Future to wait before completing reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### awaitStarted

    public void awaitStarted()
                      throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed to wait.

#### registrateProxyRestart

    public void registrateProxyRestart(Map<String,DynamicCacheChangeRequest> reqs,
                                       GridFutureAdapter<?> fut)

Parameters:
  `reqs` - Cache requests to start.
  `fut` - Completable future.

#### completeProxyRestart

    public void completeProxyRestart(Map<String,DynamicCacheChangeRequest> reqs,
                                     AffinityTopologyVersion initVer,
                                     AffinityTopologyVersion doneVer)

Parameters:
  `reqs` - Cache requests to start.
  `initVer` - Init exchange version.
  `doneVer` - Finish excahnge vertison.

#### cacheNames

    public Collection<String> cacheNames()

Gets a collection of currently started caches.

Returns:
  Collection of started cache names.

#### getOrStartPublicCache

    public IgniteCacheProxy<?,?> getOrStartPublicCache(boolean start,
                                                       boolean inclLoc)
                                                throws IgniteCheckedException

Gets public cache that can be used for query execution. If cache isn't created on current node it will be started.

Parameters:
  `start` - Start cache.
  `inclLoc` - Include local caches.
Returns:
  Cache or `null` if there is no suitable cache.
Throws:
  `IgniteCheckedException`

#### publicCacheNames

    public Collection<String> publicCacheNames()

Gets a collection of currently started public cache names.

Returns:
  Collection of currently started public cache names

#### publicAndDsCacheNames

    public Collection<String> publicAndDsCacheNames()

Gets a collection of currently started public cache names.

Returns:
  Collection of currently started public cache names

#### cacheMode

    public CacheMode cacheMode(String cacheName)

Gets cache mode.

Parameters:
  `cacheName` - Cache name to check.
Returns:
  Cache mode.

#### localJoinCachesContext

    @Nullable
    public LocalJoinCachesContext localJoinCachesContext()

Returns:
  Caches to be started when this node starts.

#### startCachesOnLocalJoin

    public IgniteInternalFuture<?> startCachesOnLocalJoin(AffinityTopologyVersion exchTopVer,
                                                          LocalJoinCachesContext locJoinCtx)
                                                   throws IgniteCheckedException

Parameters:
  `exchTopVer` - Local join exchange future version.
  `locJoinCtx` - Local join cache context.
Throws:
  `IgniteCheckedException` - If failed.

#### startReceivedCaches

    public Collection<DynamicCacheDescriptor> startReceivedCaches(UUID nodeId,
                                                                  AffinityTopologyVersion exchTopVer)
                                                           throws IgniteCheckedException

Starts statically configured caches received from remote nodes during exchange.

Parameters:
  `nodeId` - Joining node ID.
  `exchTopVer` - Current exchange version.
Returns:
  Started caches descriptors.
Throws:
  `IgniteCheckedException` - If failed.

#### restartProxies

    public void restartProxies()

Restarts proxies of caches if they was marked as restarting. Requires external synchronization - shouldn't be called concurrently with another caches restart.

#### onExchangeDone

    public void onExchangeDone(AffinityTopologyVersion cacheStartVer,
                               @Nullable
                               ExchangeActions exchActions,
                               @Nullable
                               Throwable err)

Callback invoked when first exchange future for dynamic cache is completed.

Parameters:
  `cacheStartVer` - Started caches version to create proxy for.
  `exchActions` - Change requests.
  `err` - Error.

#### discoveryDataType

    @Nullable
    public GridComponent.DiscoveryDataExchangeType discoveryDataType()

Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methods `GridComponent.collectJoiningNodeData(DiscoveryDataBag)` or `GridComponent.collectGridNodeData(DiscoveryDataBag)`.

Specified by:
  `discoveryDataType` in interface `GridComponent`
Overrides:
  `discoveryDataType` in class `GridProcessorAdapter`
Returns:
  Unique component type for discovery data exchange.

#### collectJoiningNodeData

    public void collectJoiningNodeData(DiscoveryDataBag dataBag)

Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.

Specified by:
  `collectJoiningNodeData` in interface `GridComponent`
Overrides:
  `collectJoiningNodeData` in class `GridProcessorAdapter`
Parameters:
  `dataBag` - container object to store discovery data in.

#### collectGridNodeData

    public void collectGridNodeData(DiscoveryDataBag dataBag)

Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.

Specified by:
  `collectGridNodeData` in interface `GridComponent`
Overrides:
  `collectGridNodeData` in class `GridProcessorAdapter`
Parameters:
  `dataBag` - container object to store discovery data in.

#### onJoiningNodeDataReceived

    public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)

Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.

Specified by:
  `onJoiningNodeDataReceived` in interface `GridComponent`
Overrides:
  `onJoiningNodeDataReceived` in class `GridProcessorAdapter`
Parameters:
  `data` - `DiscoveryDataBag.JoiningNodeDiscoveryData` interface to retrieve discovery data of joining node.

#### onGridDataReceived

    public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)

Receives discovery data object from remote nodes (called on new node during discovery process).

Specified by:
  `onGridDataReceived` in interface `GridComponent`
Overrides:
  `onGridDataReceived` in class `GridProcessorAdapter`
Parameters:
  `data` - `DiscoveryDataBag.GridDiscoveryData` interface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).

#### validateNode

    @Nullable
    public IgniteNodeValidationResult validateNode(ClusterNode node,
                                                             DiscoveryDataBag.JoiningNodeDiscoveryData discoData)

Specified by:
  `validateNode` in interface `GridComponent`
Overrides:
  `validateNode` in class `GridProcessorAdapter`

#### onStateChangeFinish

    public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg)

Parameters:
  `msg` - Message.

#### onStateChangeRequest

    public ExchangeActions onStateChangeRequest(ChangeGlobalStateMessage msg,
                                                AffinityTopologyVersion topVer,
                                                DiscoveryDataClusterState curState)
                                         throws IgniteCheckedException

Parameters:
  `msg` - Message.
  `topVer` - Current topology version.
  `curState` - Current cluster state.
Returns:
  Exchange actions.
Throws:
  `IgniteCheckedException` - If configuration validation failed.

#### onCacheStatisticsModeChange

    public void onCacheStatisticsModeChange(CacheStatisticsModeChangeMessage msg)

Cache statistics flag change message received.

Parameters:
  `msg` - Message.

#### processStatisticsModeChange

    public void processStatisticsModeChange(CacheStatisticsModeChangeMessage msg)

Cache statistics flag change task processed by exchange worker.

Parameters:
  `msg` - Message.

#### onTxTimeoutOnPartitionMapExchangeChange

    public void onTxTimeoutOnPartitionMapExchangeChange(TxTimeoutOnPartitionMapExchangeChangeMessage msg)

Callback invoked from discovery thread when discovery custom message is received.

Parameters:
  `msg` - Discovery message for changing transaction timeout on partition map exchange.

#### processTxTimeoutOnPartitionMapExchangeChange

    public void processTxTimeoutOnPartitionMapExchangeChange(TxTimeoutOnPartitionMapExchangeChangeMessage msg)

The task for changing transaction timeout on partition map exchange processed by exchange worker.

Parameters:
  `msg` - Message.

#### createFromTemplate

    public IgniteInternalFuture<?> createFromTemplate(String cacheName)

Dynamically starts cache using template configuration.

Parameters:
  `cacheName` - Cache name.
Returns:
  Future that will be completed when cache is deployed.

#### getOrCreateFromTemplate

    public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName,
                                                           boolean checkThreadTx)

Dynamically starts cache using template configuration.

Parameters:
  `cacheName` - Cache name.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
Returns:
  Future that will be completed when cache is deployed.

#### getOrCreateFromTemplate

    public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName,
                                                           String templateName,
                                                           CacheConfigurationOverride cfgOverride,
                                                           boolean checkThreadTx)

Dynamically starts cache using template configuration.

Parameters:
  `cacheName` - Cache name.
  `templateName` - Cache template name.
  `cfgOverride` - Cache config properties to override.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
Returns:
  Future that will be completed when cache is deployed.

#### getConfigFromTemplate

    public CacheConfiguration getConfigFromTemplate(String cacheName)
                                             throws IgniteCheckedException

Parameters:
  `cacheName` - Cache name.
Returns:
  Cache configuration, or `null` if no template with matching name found.
Throws:
  `IgniteCheckedException` - If failed.

#### dynamicStartCache

    public IgniteInternalFuture<Boolean> dynamicStartCache(@Nullable
                                                           CacheConfiguration ccfg,
                                                           String cacheName,
                                                           @Nullable
                                                           NearCacheConfiguration nearCfg,
                                                           boolean failIfExists,
                                                           boolean failIfNotStarted,
                                                           boolean checkThreadTx)

Dynamically starts cache.

Parameters:
  `ccfg` - Cache configuration.
  `cacheName` - Cache name.
  `nearCfg` - Near cache configuration.
  `failIfExists` - Fail if exists flag.
  `failIfNotStarted` - If `true` fails if cache is not started.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
Returns:
  Future that will be completed when cache is deployed.

#### dynamicStartSqlCache

    public IgniteInternalFuture<Boolean> dynamicStartSqlCache(CacheConfiguration ccfg)

Dynamically starts cache as a result of SQL `CREATE TABLE` command.

Parameters:
  `ccfg` - Cache configuration.

#### dynamicStartCache

    public IgniteInternalFuture<Boolean> dynamicStartCache(@Nullable
                                                           CacheConfiguration ccfg,
                                                           String cacheName,
                                                           @Nullable
                                                           NearCacheConfiguration nearCfg,
                                                           CacheType cacheType,
                                                           boolean sql,
                                                           boolean failIfExists,
                                                           boolean failIfNotStarted,
                                                           boolean checkThreadTx)

Dynamically starts cache.

Parameters:
  `ccfg` - Cache configuration.
  `cacheName` - Cache name.
  `nearCfg` - Near cache configuration.
  `cacheType` - Cache type.
  `sql` - If the cache needs to be created as the result of SQL `CREATE TABLE` command.
  `failIfExists` - Fail if exists flag.
  `failIfNotStarted` - If `true` fails if cache is not started.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
Returns:
  Future that will be completed when cache is deployed.

#### dynamicStartCaches

    public IgniteInternalFuture<Boolean> dynamicStartCaches(Collection<CacheConfiguration> ccfgList,
                                                            boolean failIfExists,
                                                            boolean checkThreadTx,
                                                            boolean disabledAfterStart)

Dynamically starts multiple caches.

Parameters:
  `ccfgList` - Collection of cache configuration.
  `failIfExists` - Fail if exists flag.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `disabledAfterStart` - If true, cache proxies will be only activated after `restartProxies()`.
Returns:
  Future that will be completed when all caches are deployed.

#### dynamicStartCachesByStoredConf

    public IgniteInternalFuture<Boolean> dynamicStartCachesByStoredConf(Collection<StoredCacheData> storedCacheDataList,
                                                                        boolean failIfExists,
                                                                        boolean checkThreadTx,
                                                                        boolean disabledAfterStart)

Dynamically starts multiple caches.

Parameters:
  `storedCacheDataList` - Collection of stored cache data.
  `failIfExists` - Fail if exists flag.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `disabledAfterStart` - If true, cache proxies will be only activated after `restartProxies()`.
Returns:
  Future that will be completed when all caches are deployed.

#### dynamicDestroyCache

    public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName,
                                                             boolean sql,
                                                             boolean checkThreadTx,
                                                             boolean restart)

Parameters:
  `cacheName` - Cache name to destroy.
  `sql` - If the cache needs to be destroyed only if it was created as the result of SQL `CREATE TABLE` command.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `restart` - Restart flag.
Returns:
  Future that will be completed when cache is destroyed.

#### dynamicDestroyCaches

    public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames,
                                                        boolean checkThreadTx,
                                                        boolean restart)

Parameters:
  `cacheNames` - Collection of cache names to destroy.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `restart` - Restart flag.
Returns:
  Future that will be completed when cache is destroyed.

#### dynamicDestroyCaches

    public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames,
                                                        boolean checkThreadTx,
                                                        boolean restart,
                                                        boolean destroy)

Parameters:
  `cacheNames` - Collection of cache names to destroy.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `restart` - Restart flag.
  `destroy` - Cache data destroy flag. Setting to `true` will cause removing all cache data
Returns:
  Future that will be completed when cache is destroyed.

#### createStopRequest

    @NotNull
    public DynamicCacheChangeRequest createStopRequest(String cacheName,
                                                                boolean restart,
                                                                boolean destroy)

Prepares cache stop request.

Parameters:
  `cacheName` - Cache names to destroy.
  `restart` - Restart flag.
  `destroy` - Cache data destroy flag. Setting to `true` will cause removing all cache data from store.
Returns:
  Future that will be completed when cache is destroyed.

#### dynamicChangeCaches

    @NotNull
    public IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)

Starts cache stop request as cache change batch.

Parameters:
  `reqs` - cache stop requests.
Returns:
  compound future.

#### changeWalMode

    public IgniteInternalFuture<Boolean> changeWalMode(Collection<String> cacheNames,
                                                       boolean enabled)

Change WAL mode.

Parameters:
  `cacheNames` - Cache names.
  `enabled` - Enabled flag.
Returns:
  Future completed when operation finished.

#### walEnabled

    public boolean walEnabled(String cacheName)

Parameters:
  `cacheName` - Cache name.

#### resetCacheState

    public IgniteInternalFuture<?> resetCacheState(Collection<String> cacheNames)

Resets cache state after the cache has been moved to recovery state.

Parameters:
  `cacheNames` - Cache names.
Returns:
  Future that will be completed when state is changed for all caches.

#### cacheType

    public CacheType cacheType(String cacheName)

Parameters:
  `cacheName` - Cache name.
Returns:
  Cache type.

#### saveCacheConfiguration

    public void saveCacheConfiguration(DynamicCacheDescriptor desc)
                                throws IgniteCheckedException

Save cache configuration to persistent store if necessary.

Parameters:
  `desc` - Cache descriptor.
Throws:
  `IgniteCheckedException`

#### cleanupCachesDirectories

    public void cleanupCachesDirectories()
                                  throws IgniteCheckedException

Remove all persistent files for all registered caches.

Throws:
  `IgniteCheckedException`

#### onDiscoveryEvent

    public void onDiscoveryEvent(int type,
                                 @Nullable
                                 DiscoveryCustomMessage customMsg,
                                 ClusterNode node,
                                 AffinityTopologyVersion topVer,
                                 DiscoveryDataClusterState state)

Parameters:
  `type` - Event type.
  `customMsg` - Custom message instance.
  `node` - Event node.
  `topVer` - Topology version.
  `state` - Cluster state.

#### onCustomEvent

    public boolean onCustomEvent(DiscoveryCustomMessage msg,
                                 AffinityTopologyVersion topVer,
                                 ClusterNode node)

Callback invoked from discovery thread when discovery custom message is received.

Parameters:
  `msg` - Customer message.
  `topVer` - Current topology version.
  `node` - Node sent message.
Returns:
  `True` if minor topology version should be increased.

#### validateNode

    @Nullable
    public IgniteNodeValidationResult validateNode(ClusterNode node)

Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

Specified by:
  `validateNode` in interface `GridComponent`
Overrides:
  `validateNode` in class `GridProcessorAdapter`
Parameters:
  `node` - Joining node.
Returns:
  Validation result or `null` in case of success.

#### resetRestartingCaches

    public void resetRestartingCaches()

Reset restarting caches.

#### lastDataVersion

    public long lastDataVersion()

Returns:
  Last data version.

#### cache

    public <K,V> IgniteInternalCache<K,V> cache(String name)

Type Parameters:
  `K` - type of keys.
  `V` - type of values.
Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.

#### completeProxyInitialize

    public void completeProxyInitialize(String name)

Parameters:
  `name` - Cache name.

#### getOrStartCache

    public <K,V> IgniteInternalCache<K,V> getOrStartCache(String name)
                                                   throws IgniteCheckedException

Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.
Throws:
  `IgniteCheckedException` - If failed.

#### getOrStartCache

    public <K,V> IgniteInternalCache<K,V> getOrStartCache(String name,
                                                          CacheConfiguration ccfg)
                                                   throws IgniteCheckedException

Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.
Throws:
  `IgniteCheckedException` - If failed.

#### caches

    public Collection<IgniteInternalCache<?,?>> caches()

Returns:
  All configured cache instances.

#### jcaches

    public Collection<IgniteCacheProxy<?,?>> jcaches()

Returns:
  All configured cache instances.

#### utilityCache

    public <K,V> IgniteInternalCache<K,V> utilityCache()

Gets utility cache.

Returns:
  Utility cache.

#### publicCache

    public <K,V> IgniteInternalCache<K,V> publicCache(String name)

Type Parameters:
  `K` - type of keys.
  `V` - type of values.
Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.

#### publicJCache

    public <K,V> IgniteCacheProxy<K,V> publicJCache(String cacheName)
                                             throws IgniteCheckedException

Type Parameters:
  `K` - type of keys.
  `V` - type of values.
Parameters:
  `cacheName` - Cache name.
Returns:
  Cache instance for given name.
Throws:
  `IgniteCheckedException` - If failed.

#### publicJCache

    @Nullable
    public <K,V> IgniteCacheProxy<K,V> publicJCache(String cacheName,
                                                              boolean failIfNotStarted,
                                                              boolean checkThreadTx)
                                                       throws IgniteCheckedException

Parameters:
  `cacheName` - Cache name.
  `failIfNotStarted` - If `true` throws `IllegalArgumentException` if cache is not started, otherwise returns `null` in this case.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
Returns:
  Cache instance for given name.
Throws:
  `IgniteCheckedException` - If failed.

#### cacheConfiguration

    public CacheConfiguration cacheConfiguration(String name)

Get configuration for the given cache.

Parameters:
  `name` - Cache name.
Returns:
  Cache configuration.

#### cacheDescriptor

    public DynamicCacheDescriptor cacheDescriptor(String name)

Get registered cache descriptor.

Parameters:
  `name` - Name.
Returns:
  Descriptor.

#### cacheDescriptors

    public Map<String,DynamicCacheDescriptor> cacheDescriptors()

Returns:
  Cache descriptors.

#### cacheGroupDescriptors

    public Map<Integer,CacheGroupDescriptor> cacheGroupDescriptors()

Returns:
  Cache group descriptors.

#### cacheDescriptor

    @Nullable
    public DynamicCacheDescriptor cacheDescriptor(int cacheId)

Parameters:
  `cacheId` - Cache ID.
Returns:
  Cache descriptor.

#### addCacheConfiguration

    public void addCacheConfiguration(CacheConfiguration cacheCfg)
                               throws IgniteCheckedException

Parameters:
  `cacheCfg` - Cache configuration template.
Throws:
  `IgniteCheckedException` - If failed.

#### jcache

    public <K,V> IgniteCacheProxy<K,V> jcache(String name)

Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.

#### jcacheProxy

    @Nullable
    public IgniteCacheProxyImpl<?,?> jcacheProxy(String name,
                                                           boolean awaitInit)

Parameters:
  `name` - Cache name.
  `awaitInit` - Await proxy initialization.
Returns:
  Cache proxy.

#### addjCacheProxy

    @Nullable
    public IgniteCacheProxyImpl<?,?> addjCacheProxy(String name,
                                                              IgniteCacheProxyImpl<?,?> proxy)

Parameters:
  `name` - Cache name.
  `proxy` - Cache proxy.
Returns:
  Previous cache proxy.

#### publicCaches

    public Collection<IgniteCacheProxy<?,?>> publicCaches()

Returns:
  All configured public cache instances.

#### internalCache

    public <K,V> GridCacheAdapter<K,V> internalCache(String name)

Type Parameters:
  `K` - type of keys.
  `V` - type of values.
Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name.

#### internalCaches

    public Collection<GridCacheAdapter<?,?>> internalCaches()

Returns:
  All internal cache instances.

#### systemCache

    public boolean systemCache(String name)

Parameters:
  `name` - Cache name.
Returns:
  `True` if specified cache is system, `false` otherwise.

#### printMemoryStats

    public void printMemoryStats()

Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridComponent`
Overrides:
  `printMemoryStats` in class `GridProcessorAdapter`

#### onUndeployed

    public void onUndeployed(ClassLoader ldr)

Callback invoked by deployment manager for whenever a class loader gets undeployed.

Parameters:
  `ldr` - Class loader.

#### context

    public <K,V> GridCacheSharedContext<K,V> context()

Returns:
  Shared context.

#### transactions

    public IgniteTransactionsEx transactions()

Returns:
  Transactions interface implementation.

#### createMissingQueryCaches

    public void createMissingQueryCaches()
                                  throws IgniteCheckedException

Starts client caches that do not exist yet.

Throws:
  `IgniteCheckedException` - In case of error.

#### checkEmptyTransactions

    public void checkEmptyTransactions()
                                throws IgniteException

Method checks that current thread does not have active transactions.

Throws:
  `IgniteException` - If transaction exist.

#### enableStatistics

    public void enableStatistics(Collection<String> cacheNames,
                                 boolean enabled)
                          throws IgniteCheckedException

Enable/disable statistics globally for the caches

Parameters:
  `cacheNames` - Collection of cache names.
  `enabled` - Statistics enabled flag.
Throws:
  `IgniteCheckedException`

#### clearStatistics

    public void clearStatistics(Collection<String> cacheNames)
                         throws IgniteCheckedException

Clear statistics globally for the caches

Parameters:
  `cacheNames` - Collection of cache names.
Throws:
  `IgniteCheckedException`

#### setTxTimeoutOnPartitionMapExchange

    public void setTxTimeoutOnPartitionMapExchange(long timeout)
                                            throws IgniteCheckedException

Sets transaction timeout on partition map exchange.

Parameters:
  `timeout` - Transaction timeout on partition map exchange in milliseconds.
Throws:
  `IgniteCheckedException`

#### clone

    public <T> T clone(T obj)
                throws IgniteCheckedException

Parameters:
  `obj` - Object to clone.
Returns:
  Object copy.
Throws:
  `IgniteCheckedException` - If failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019