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, GridProcessor

    public class GridCacheProcessor
    extends GridProcessorAdapter

The main responsibility of this processor is orchestrating of starting, stopping caches and everything related to that activity like validation of cache configuration, restoring configuration from persistence, etc.

### Nested Class Summary

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

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`static String` `CACHE_GRP_IO_VIEW` System view name for cache group IO.
`static String` `CACHE_GRP_IO_VIEW_DESC` System view description for cache group IO.
`static String` `CACHE_GRP_PAGE_LIST_VIEW` System view name for page lists.
`static String` `CACHE_GRP_PAGE_LIST_VIEW_DESC` System view description for page lists.
`static String` `CLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMAT`
`static boolean` `DFLT_ALLOW_START_CACHES_IN_PARALLEL`
`static String` `EXPRITY_POLICY_MSG`
`static String` `PART_STATES_VIEW` System view name for partition states.
`static String` `PART_STATES_VIEW_DESC` System view description for partition states.

### 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)`
`@Nullable IgniteCacheProxyImpl<?,?>` `addjCacheProxy(String name, IgniteCacheProxyImpl<?,?> proxy)`
`void` `awaitStarted()` Await for local join finish and caches start.
`void` `blockGateway(String cacheName, boolean stop, boolean restart)`
`void` `blockGateways()` Blocks all available gateways
`List<GridCacheAdapter>` `blockGateways(Collection<Integer> cacheGrpIds)` Blocks (stops) cache gateway for caches according to given `cacheGroupIds`.
`<K,V> @Nullable IgniteInternalCache<K,V>` `cache(String name)`
`CacheConfiguration` `cacheConfiguration(String name)` Get configuration for the given cache.
`@Nullable DynamicCacheDescriptor` `cacheDescriptor(int cacheId)`
`DynamicCacheDescriptor` `cacheDescriptor(String name)` Get registered cache descriptor.
`Map<String,DynamicCacheDescriptor>` `cacheDescriptors()`
`@Nullable CacheGroupContext` `cacheGroup(int grpId)`
`CacheGroupDescriptor` `cacheGroupDescriptor(int grpId)` Tries to find cache group descriptor either in registered cache groups or in marked for deletion collection if cache group is considered to be stopped.
`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)`
`void` `checkReadOnlyState(String opName, CacheConfiguration... cfgs)` Checks that cluster in a `ClusterState.ACTIVE_READ_ONLY` state.
`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` `completeCacheStartFuture(DynamicCacheChangeRequest req, boolean success, @Nullable Throwable err)`
`void` `completeProxyInitialize(String name)`
`void` `completeProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, AffinityTopologyVersion initVer, AffinityTopologyVersion doneVer)`
`GridLocalConfigManager` `configManager()`
`<K,V> GridCacheSharedContext<K,V>` `context()`
`IgniteInternalFuture<?>` `createFromTemplate(String cacheName)` Dynamically starts cache using template configuration.
`@NotNull DynamicCacheChangeRequest` `createStopRequest(String cacheName, boolean restart, IgniteUuid restartId, boolean destroy)` Prepares cache stop request.
`@Nullable GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`@NotNull IgniteInternalFuture<?>` `dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)` Starts cache stop request as cache change batch.
`IgniteInternalFuture<Boolean>` `dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart, IgniteUuid restartId)`
`IgniteInternalFuture<?>` `dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx)`
`IgniteInternalFuture<?>` `dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean destroy)`
`IgniteInternalFuture<Boolean>` `dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)` Dynamically starts cache.
`IgniteInternalFuture<Boolean>` `dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable 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, IgniteUuid restartId)` Dynamically starts multiple caches.
`IgniteInternalFuture<Boolean>` `dynamicStartSqlCache(CacheConfiguration ccfg)` Dynamically starts cache as a result of SQL `CREATE TABLE` command.
`void` `enableStatistics(Collection<String> cacheNames, boolean enabled)` Enable/disable statistics globally for the caches
`CacheConfigurationEnricher` `enricher()`
`CachePartitionExchangeWorkerTask` `exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)` Create exchange worker task for custom discovery message.
`IgniteInternalFuture<?>` `finalizePartitionsCounters()` Finalizes partitions update counters.
`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)` Gets public cache that can be used for query execution.
`boolean` `hasCachesReceivedFromJoin(ClusterNode node)`
`<K,V> GridCacheAdapter<K,V>` `internalCache(String name)`
`Collection<GridCacheAdapter<?,?>>` `internalCaches()`
`boolean` `isCacheRestarting(String cacheName)`
`boolean` `isEncrypted(int cacheGrpId)`
`<K,V> IgniteCacheProxy<K,V>` `jcache(String name)`
`@Nullable IgniteCacheProxyImpl<?,?>` `jcacheProxy(String name, boolean awaitInit)`
`Collection<IgniteCacheProxy<?,?>>` `jcaches()`
`boolean` `keepStaticCacheConfiguration()`
`@Nullable 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, @Nullable DiscoveryCustomMessage customMsg, ClusterNode node, AffinityTopologyVersion topVer, DiscoveryDataClusterState state)`
`void` `onExchangeDone(AffinityTopologyVersion cacheStartVer, @Nullable ExchangeActions exchActions, @Nullable 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)`
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`void` `onStateChangeFinish(ChangeGlobalStateFinishMessage msg)`
`ExchangeActions` `onStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer, DiscoveryDataClusterState curState)`
`void` `onUndeployed(ClassLoader ldr)` Callback invoked by deployment manager for whenever a class loader gets undeployed.
`Collection<DynamicCacheDescriptor>` `persistentCaches()`
`Collection<CacheGroupDescriptor>` `persistentGroups()`
`void` `prepareCacheStart(DynamicCacheDescriptor desc, @Nullable NearCacheConfiguration reqNearCfg, AffinityTopologyVersion exchTopVer, boolean disabledAfterStart, boolean clientCache)`
`void` `prepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache)`
`void` `prepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache, boolean clearDbObjects)`
`void` `preparePageStore(DynamicCacheDescriptor desc, boolean affNode)` Prepare page store for start cache.
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`void` `processStatisticsModeChange(CacheStatisticsModeChangeMessage msg)` Cache statistics flag change task 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> @Nullable 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.
`List<String>` `resetRestartingProxies()` Complete stopping of caches if they were marked as restarting but it failed.
`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` `shutdownNotFinishedRecoveryCaches()` Stops all caches and groups, that was recovered, but not activated on node join.
`CacheConfigurationSplitter` `splitter()`
`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` `stopWarmUp()` Stop warming up and current running strategy.
`boolean` `systemCache(String name)`
`IgniteTransactionsEx` `transactions()`
`<K,V> IgniteInternalCache<K,V>` `utilityCache()` Gets utility cache.
`@Nullable IgniteNodeValidationResult` `validateNode(ClusterNode node)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
`@Nullable IgniteNodeValidationResult` `validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

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

### Field Detail

#### CLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMAT

    public static final String CLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMAT

See Also:
  Constant Field Values

#### CACHE_GRP_PAGE_LIST_VIEW

    public static final String CACHE_GRP_PAGE_LIST_VIEW

System view name for page lists.

See Also:
  Constant Field Values

#### CACHE_GRP_PAGE_LIST_VIEW_DESC

    public static final String CACHE_GRP_PAGE_LIST_VIEW_DESC

System view description for page lists.

See Also:
  Constant Field Values

#### PART_STATES_VIEW

    public static final String PART_STATES_VIEW

System view name for partition states.

See Also:
  Constant Field Values

#### PART_STATES_VIEW_DESC

    public static final String PART_STATES_VIEW_DESC

System view description for partition states.

See Also:
  Constant Field Values

#### CACHE_GRP_IO_VIEW

    public static final String CACHE_GRP_IO_VIEW

System view name for cache group IO.

#### CACHE_GRP_IO_VIEW_DESC

    public static final String CACHE_GRP_IO_VIEW_DESC

System view description for cache group IO.

See Also:
  Constant Field Values

#### DFLT_ALLOW_START_CACHES_IN_PARALLEL

    public static final boolean DFLT_ALLOW_START_CACHES_IN_PARALLEL

See Also:
  `IgniteSystemProperties.IGNITE_ALLOW_START_CACHES_IN_PARALLEL`, Constant Field Values

#### EXPRITY_POLICY_MSG

    public static final String EXPRITY_POLICY_MSG

See Also:
  Constant Field Values

### Constructor Detail

#### GridCacheProcessor

    public GridCacheProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

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

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

#### awaitStarted

    public void awaitStarted()
                      throws IgniteCheckedException

Await for local join finish and caches start.

Throws:
  `IgniteCheckedException` - If failed to wait.

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

#### blockGateways

    public List<GridCacheAdapter> blockGateways(Collection<Integer> cacheGrpIds)

Blocks (stops) cache gateway for caches according to given `cacheGroupIds`.

Parameters:
  `cacheGrpIds` - Cache group ids for which cache gateway should be stopped.
Returns:
  Caches for which cache gateway is blocked (stopped).

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

#### 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)
                                                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.
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 @Nullable 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.

#### hasCachesReceivedFromJoin

    public boolean hasCachesReceivedFromJoin(ClusterNode node)

Parameters:
  `node` - Joined node.
Returns:
  `True` if there are new caches received from joined node.

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

#### prepareCacheStart

    public void prepareCacheStart(DynamicCacheDescriptor desc,
                                  @Nullable
                                  @Nullable NearCacheConfiguration reqNearCfg,
                                  AffinityTopologyVersion exchTopVer,
                                  boolean disabledAfterStart,
                                  boolean clientCache)
                           throws IgniteCheckedException

Parameters:
  `desc` - Cache descriptor.
  `reqNearCfg` - Near configuration if specified for client cache start request.
  `exchTopVer` - Current exchange version.
  `disabledAfterStart` - If true, then we will discard restarting state from proxies. If false then we will change state of proxies to restarting
Throws:
  `IgniteCheckedException` - If failed.

#### shutdownNotFinishedRecoveryCaches

    public void shutdownNotFinishedRecoveryCaches()

Stops all caches and groups, that was recovered, but not activated on node join. Such caches can remain only if it was filtered by node filter on current node. It's impossible to check whether current node is affinity node for given cache before join to topology.

#### preparePageStore

    public void preparePageStore(DynamicCacheDescriptor desc,
                                 boolean affNode)
                          throws IgniteCheckedException

Prepare page store for start cache.

Parameters:
  `desc` - Cache descriptor.
  `affNode` - `true` if it is affinity node for cache.
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.

#### resetRestartingProxies

    public List<String> resetRestartingProxies()

Complete stopping of caches if they were marked as restarting but it failed.

Returns:
  Cache names of proxies which were restarted.

#### blockGateway

    public void blockGateway(String cacheName,
                             boolean stop,
                             boolean restart)

Parameters:
  `cacheName` - Cache name.
  `stop` - `True` for stop cache, `false` for close cache.
  `restart` - Restart flag.

#### prepareCacheStop

    public void prepareCacheStop(String cacheName,
                                 boolean callDestroy,
                                 boolean clearCache)

Parameters:
  `cacheName` - Cache name.
  `callDestroy` - Cache destroy flag. This flag is passed to the `GridCacheManager.stop(boolean, boolean)` method.
  `clearCache` - Cache data clear flag. Setting to `true` will remove all cache data.

#### prepareCacheStop

    public void prepareCacheStop(String cacheName,
                                 boolean callDestroy,
                                 boolean clearCache,
                                 boolean clearDbObjects)

Parameters:
  `cacheName` - Cache name.
  `callDestroy` - Cache destroy flag. This flag is passed to the `GridCacheManager.stop(boolean, boolean)` method.
  `clearCache` - Cache data clear flag. Setting to `true` will remove all cache data.
  `clearDbObjects` - If `false` DB objects don't removed (used for cache.close() on client node).

#### onExchangeDone

    public void onExchangeDone(AffinityTopologyVersion cacheStartVer,
                               @Nullable
                               @Nullable ExchangeActions exchActions,
                               @Nullable
                               @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.

#### completeCacheStartFuture

    public void completeCacheStartFuture(DynamicCacheChangeRequest req,
                                         boolean success,
                                         @Nullable
                                         @Nullable Throwable err)

Parameters:
  `req` - Request to complete future for.
  `success` - Future result.
  `err` - Error if any.

#### discoveryDataType

    @Nullable
    public @Nullable 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 @Nullable IgniteNodeValidationResult validateNode(ClusterNode node,
                                                                       DiscoveryDataBag.JoiningNodeDiscoveryData discoData)

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.
  `discoData` - Joining node discovery data.
Returns:
  Validation result or `null` in case of success.

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

#### 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
                                                           @Nullable CacheConfiguration ccfg,
                                                           String cacheName,
                                                           @Nullable
                                                           @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
                                                           @Nullable CacheConfiguration ccfg,
                                                           String cacheName,
                                                           @Nullable
                                                           @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.

#### checkReadOnlyState

    public void checkReadOnlyState(String opName,
                                   CacheConfiguration... cfgs)

Checks that cluster in a `ClusterState.ACTIVE_READ_ONLY` state.

Parameters:
  `opName` - Operation name.
  `cfgs` - Cache configurations.
Throws:
  `javax.cache.CacheException` - If cluster in a `ClusterState.ACTIVE_READ_ONLY` state.

#### 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,
                                                                        IgniteUuid restartId)

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()`.
  `restartId` - Restart requester id (it'll allow to start this cache only him).
Returns:
  Future that will be completed when all caches are deployed.

#### dynamicDestroyCache

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

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.
  `restartId` - Restart requester id (it'll allow to start this cache only him).
Returns:
  Future that will be completed when cache is destroyed.

#### dynamicDestroyCaches

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

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

#### dynamicDestroyCaches

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

Parameters:
  `cacheNames` - Collection of cache names to destroy.
  `checkThreadTx` - If `true` checks that current thread does not have active transactions.
  `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 @NotNull DynamicCacheChangeRequest createStopRequest(String cacheName,
                                                                         boolean restart,
                                                                         IgniteUuid restartId,
                                                                         boolean destroy)

Prepares cache stop request.

Parameters:
  `cacheName` - Cache names to destroy.
  `restart` - Restart flag.
  `restartId` - Restart requester id (it'll allow to start this cache only him).
  `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 @NotNull IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)

Starts cache stop request as cache change batch.

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

#### resetCacheState

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

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.
Throws:
  `ClusterTopologyCheckedException`

#### finalizePartitionsCounters

    public IgniteInternalFuture<?> finalizePartitionsCounters()

Finalizes partitions update counters.

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.

#### isEncrypted

    public boolean isEncrypted(int cacheGrpId)

Returns:
  `True` if cache group `cacheGrpId` is encrypted. `False` otherwise.

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

#### isCacheRestarting

    public boolean isCacheRestarting(String cacheName)

Parameters:
  `cacheName` - Cache to check.
Returns:
  Cache is under restarting.

#### keepStaticCacheConfiguration

    public boolean keepStaticCacheConfiguration()

Returns:
  Keep static cache configuration flag. If `true`, static cache configuration will override configuration persisted on disk.

#### cache

    @Nullable
    public <K,V> @Nullable 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.
Throws:
  `IllegalArgumentException` - If cache not exists.

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

#### persistentCaches

    public Collection<DynamicCacheDescriptor> persistentCaches()

Returns:
  Collection of persistent cache descriptors.

#### persistentGroups

    public Collection<CacheGroupDescriptor> persistentGroups()

Returns:
  Collection of persistent cache group descriptors.

#### cacheGroupDescriptors

    public Map<Integer,CacheGroupDescriptor> cacheGroupDescriptors()

Returns:
  Cache group descriptors.

#### cacheGroupDescriptor

    public CacheGroupDescriptor cacheGroupDescriptor(int grpId)

Tries to find cache group descriptor either in registered cache groups or in marked for deletion collection if cache group is considered to be stopped.

Parameters:
  `grpId` - Group id.

#### cacheDescriptor

    @Nullable
    public @Nullable 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 @Nullable IgniteCacheProxyImpl<?,?> jcacheProxy(String name,
                                                                     boolean awaitInit)

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

#### addjCacheProxy

    @Nullable
    public @Nullable 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.

#### configManager

    public GridLocalConfigManager configManager()

Returns:
  Local config manager.

#### transactions

    public IgniteTransactionsEx transactions()

Returns:
  Transactions interface implementation.

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

#### clone

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

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

#### splitter

    public CacheConfigurationSplitter splitter()

Returns:
  By default it returns splitter without old format configuration support.

#### enricher

    public CacheConfigurationEnricher enricher()

Returns:
  Cache configuration enricher.

#### stopWarmUp

    public boolean stopWarmUp()
                       throws IgniteCheckedException

Stop warming up and current running strategy.

Returns:
  `true` if stopped by this call.
Throws:
  `IgniteCheckedException` - If there is an error when stopping warm-up.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023