org.apache.ignite

## Class IgniteSpringBean

- java.lang.Object
- - org.apache.ignite.IgniteSpringBean

- All Implemented Interfaces:
    Externalizable, Serializable, AutoCloseable, Ignite, org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware

      public class IgniteSpringBean
      extends Object
      implements Ignite, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, Externalizable

  Ignite Spring bean allows to bypass `Ignition` methods. In other words, this bean class allows to inject new grid instance from Spring configuration file directly without invoking static `Ignition` methods. This class can be wired directly from Spring and can be referenced from within other Spring beans. By virtue of implementing `DisposableBean` and `SmartInitializingSingleton` interfaces, `IgniteSpringBean` automatically starts and stops underlying grid instance.

  A note should be taken that Ignite instance is started after all other Spring beans have been initialized and right before Spring context is refreshed. That implies that it's not valid to reference IgniteSpringBean from any kind of Spring bean init methods like `PostConstruct`. If it's required to reference IgniteSpringBean for other bean initialization purposes, it should be done from a `ContextRefreshedEvent` listener method declared in that bean.

  # Spring Configuration Example

  Here is a typical example of describing it in Spring file:

       <bean id="mySpringBean" class="org.apache.ignite.IgniteSpringBean">
           <property name="configuration">
               <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
                   <property name="igniteInstanceName" value="mySpringGrid"/>
               </bean>
           </property>
       </bean>

  Or use default configuration:

       <bean id="mySpringBean" class="org.apache.ignite.IgniteSpringBean"/>

  # Java Example

  Here is how you may access this bean from code:

       AbstractApplicationContext ctx = new FileSystemXmlApplicationContext("/path/to/spring/file");

       // Register Spring hook to destroy bean automatically.
       ctx.registerShutdownHook();

       Ignite ignite = (Ignite)ctx.getBean("mySpringBean");

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteSpringBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `active()` Checks Ignite grid is active or not active.
    `void` | `active(boolean active)` Changes Ignite grid state to active or inactive.
    `<K,V> void` | `addCacheConfiguration(CacheConfiguration<K,V> cacheCfg)` Adds cache configuration template.
    `<K> Affinity<K>` | `affinity(String cacheName)` Gets affinity service to provide information about data partitioning and distribution.
    `void` | `afterSingletonsInstantiated()`
    `IgniteAtomicLong` | `atomicLong(String name, AtomicConfiguration cfg, long initVal, boolean create)` Will get a atomic long from cache and create one if it has not been created yet and `create` flag is `true`.
    `@Nullable IgniteAtomicLong` | `atomicLong(String name, long initVal, boolean create)` Will get a atomic long from cache and create one if it has not been created yet and `create` flag is `true`.
    `<T> IgniteAtomicReference<T>` | `atomicReference(String name, AtomicConfiguration cfg, T initVal, boolean create)` Will get a atomic reference from cache and create one if it has not been created yet and `create` flag is `true`.
    `<T> @Nullable IgniteAtomicReference<T>` | `atomicReference(String name, T initVal, boolean create)` Will get a atomic reference from cache and create one if it has not been created yet and `create` flag is `true`.
    `IgniteAtomicSequence` | `atomicSequence(String name, AtomicConfiguration cfg, long initVal, boolean create)` Will get an atomic sequence from cache and create one if it has not been created yet and `create` flag is `true`.
    `@Nullable IgniteAtomicSequence` | `atomicSequence(String name, long initVal, boolean create)` Will get an atomic sequence from cache and create one if it has not been created yet and `create` flag is `true`.
    `<T,S> IgniteAtomicStamped<T,S>` | `atomicStamped(String name, AtomicConfiguration cfg, T initVal, S initStamp, boolean create)` Will get a atomic stamped from cache and create one if it has not been created yet and `create` flag is `true`.
    `<T,S> @Nullable IgniteAtomicStamped<T,S>` | `atomicStamped(String name, T initVal, S initStamp, boolean create)` Will get a atomic stamped from cache and create one if it has not been created yet and `create` flag is `true`.
    `IgniteBinary` | `binary()` Gets an instance of `IgniteBinary` interface.
    `<K,V> IgniteCache<K,V>` | `cache(@Nullable String name)` Gets an instance of `IgniteCache` API for the given name if one is configured or `null` otherwise.
    `Collection<String>` | `cacheNames()` Gets the collection of names of currently available caches.
    `protected void` | `checkIgnite()` Checks if this bean is valid.
    `void` | `close()` Closes `this` instance of grid.
    `IgniteCluster` | `cluster()` Gets an instance of `IgniteCluster` interface.
    `IgniteCompute` | `compute()` Gets `compute` facade over all cluster nodes started in server mode.
    `IgniteCompute` | `compute(ClusterGroup grp)` Gets `compute` facade over the specified cluster group.
    `IgniteConfiguration` | `configuration()` Gets the configuration of this Ignite instance.
    `@Nullable IgniteCountDownLatch` | `countDownLatch(String name, int cnt, boolean autoDel, boolean create)` Gets or creates count down latch.
    `<K,V> IgniteCache<K,V>` | `createCache(CacheConfiguration<K,V> cacheCfg)` Dynamically starts new cache with the given cache configuration.
    `<K,V> IgniteCache<K,V>` | `createCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)` Dynamically starts new cache with the given cache configuration.
    `<K,V> IgniteCache<K,V>` | `createCache(String cacheName)` Dynamically starts new cache using template configuration.
    `Collection<IgniteCache>` | `createCaches(Collection<CacheConfiguration> cacheCfgs)` Dynamically starts new caches with the given cache configurations.
    `<K,V> IgniteCache<K,V>` | `createNearCache(String cacheName, NearCacheConfiguration<K,V> nearCfg)` Starts a near cache on local node if cache was previously started with one of the `Ignite.createCache(CacheConfiguration)` or `Ignite.createCache(CacheConfiguration, NearCacheConfiguration)` methods.
    `Collection<DataRegionMetrics>` | `dataRegionMetrics()` Returns a collection of `DataRegionMetrics` that reflects page memory usage on this Apache Ignite node instance.
    `@Nullable DataRegionMetrics` | `dataRegionMetrics(String memPlcName)` Returns the latest `DataRegionMetrics` snapshot for the memory region of the given name.
    `DataStorageMetrics` | `dataStorageMetrics()`
    `<K,V> IgniteDataStreamer<K,V>` | `dataStreamer(@Nullable String cacheName)` Gets a new instance of data streamer associated with given cache name.
    `void` | `destroy()`
    `void` | `destroyCache(String cacheName)` Destroys a cache with the given name and cleans data that was written to the cache.
    `void` | `destroyCaches(Collection<String> cacheNames)` Destroys caches with the given names and cleans data that was written to the caches.
    `IgniteEncryption` | `encryption()` Gets an instance of `IgniteEncryption` interface.
    `IgniteEvents` | `events()` Gets `events` facade over all cluster nodes.
    `IgniteEvents` | `events(ClusterGroup grp)` Gets `events` facade over nodes within the cluster group.
    `ExecutorService` | `executorService()` Creates a new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on all cluster nodes.
    `ExecutorService` | `executorService(ClusterGroup grp)` Creates a new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on nodes in the specified cluster group.
    `org.springframework.context.ApplicationContext` | `getApplicationContext()` Gets the spring application context this Ignite runs in.
    `IgniteConfiguration` | `getConfiguration()` Gets the configuration of this Ignite instance.
    `<K,V> IgniteCache<K,V>` | `getOrCreateCache(CacheConfiguration<K,V> cacheCfg)` Gets existing cache with the given name or creates new one with the given configuration.
    `<K,V> IgniteCache<K,V>` | `getOrCreateCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)` Gets existing cache with the given cache configuration or creates one if it does not exist.
    `<K,V> IgniteCache<K,V>` | `getOrCreateCache(String cacheName)` Gets existing cache with the given name or creates new one using template configuration.
    `Collection<IgniteCache>` | `getOrCreateCaches(Collection<CacheConfiguration> cacheCfgs)` Gets existing caches with the given name or created one with the given configuration.
    `<K,V> IgniteCache<K,V>` | `getOrCreateNearCache(@Nullable String cacheName, NearCacheConfiguration<K,V> nearCfg)` Gets existing near cache with the given name or creates a new one.
    `IgniteLogger` | `log()` Gets grid's logger.
    `Collection<MemoryMetrics>` | `memoryMetrics()`
    `@Nullable MemoryMetrics` | `memoryMetrics(String memPlcName)`
    `IgniteMessaging` | `message()` Gets `messaging` facade over all cluster nodes.
    `IgniteMessaging` | `message(ClusterGroup prj)` Gets `messaging` facade over nodes within the cluster group.
    `String` | `name()` Gets the name of the Ignite instance.
    `PersistenceMetrics` | `persistentStoreMetrics()`
    `<T extends IgnitePlugin> T` | `plugin(String name)` Gets an instance of deployed Ignite plugin.
    `<T> @Nullable IgniteQueue<T>` | `queue(String name, int cap, CollectionConfiguration cfg)` Will get a named queue from cache and create one if it has not been created yet and `cfg` is not `null`.
    `void` | `readExternal(ObjectInput in)`
    `@Nullable IgniteLock` | `reentrantLock(String name, boolean failoverSafe, boolean fair, boolean create)` Gets or creates reentrant lock.
    `void` | `resetLostPartitions(Collection<String> cacheNames)` Clears partition's lost state and moves caches to a normal mode.
    `IgniteScheduler` | `scheduler()` Gets an instance of cron-based scheduler.
    `@Nullable IgniteSemaphore` | `semaphore(String name, int cnt, boolean failoverSafe, boolean create)` Gets or creates semaphore.
    `IgniteServices` | `services()` Gets `services` facade over all cluster nodes started in server mode.
    `IgniteServices` | `services(ClusterGroup grp)` Gets `services` facade over nodes within the cluster group.
    `<T> @Nullable IgniteSet<T>` | `set(String name, CollectionConfiguration cfg)` Will get a named set from cache and create one if it has not been created yet and `cfg` is not `null`.
    `void` | `setApplicationContext(org.springframework.context.ApplicationContext ctx)`
    `void` | `setConfiguration(IgniteConfiguration cfg)` Sets Ignite configuration.
    `IgniteSnapshot` | `snapshot()`
    `String` | `toString()`
    `@NotNull TracingConfigurationManager` | `tracingConfiguration()` Returns the `TracingConfigurationManager` instance that allows to Configure tracing parameters such as sampling rate for the specific tracing coordinates such as scope and label.
    `IgniteTransactions` | `transactions()` Gets grid transactions facade.
    `IgniteProductVersion` | `version()` Gets Ignite version.
    `void` | `writeExternal(ObjectOutput out)`

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

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

- - ### Constructor Detail

    - #### IgniteSpringBean

          public IgniteSpringBean()

  - ### Method Detail

    - #### configuration

          public IgniteConfiguration configuration()

      Gets the configuration of this Ignite instance.

      NOTE:
      SPIs obtains through this method should never be used directly. SPIs provide internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via this method to check its configuration properties or call other non-SPI methods.

      Specified by:
        `configuration` in interface `Ignite`
      Returns:
        Ignite configuration instance.

    - #### getConfiguration

          public IgniteConfiguration getConfiguration()

      Gets the configuration of this Ignite instance.

      This method is required for proper Spring integration and is the same as `configuration()`. See https://issues.apache.org/jira/browse/IGNITE-1102 for details.

      NOTE:
      SPIs obtains through this method should never be used directly. SPIs provide internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via this method to check its configuration properties or call other non-SPI methods.

      Returns:
        Ignite configuration instance.
      See Also:
        `configuration()`

    - #### setConfiguration

          public void setConfiguration(IgniteConfiguration cfg)

      Sets Ignite configuration.
      Parameters:
        `cfg` - Ignite configuration.

    - #### getApplicationContext

          public org.springframework.context.ApplicationContext getApplicationContext()
                                                                               throws org.springframework.beans.BeansException

      Gets the spring application context this Ignite runs in.
      Returns:
        Application context this Ignite runs in.
      Throws:
        `org.springframework.beans.BeansException`

    - #### setApplicationContext

          public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
                                     throws org.springframework.beans.BeansException

      Specified by:
        `setApplicationContext` in interface `org.springframework.context.ApplicationContextAware`
      Throws:
        `org.springframework.beans.BeansException`

    - #### destroy

          public void destroy()
                       throws Exception

      Specified by:
        `destroy` in interface `org.springframework.beans.factory.DisposableBean`
      Throws:
        `Exception`

    - #### afterSingletonsInstantiated

          public void afterSingletonsInstantiated()

      Specified by:
        `afterSingletonsInstantiated` in interface `org.springframework.beans.factory.SmartInitializingSingleton`

    - #### log

          public IgniteLogger log()

      Gets grid's logger.
      Specified by:
        `log` in interface `Ignite`
      Returns:
        Grid's logger.

    - #### version

          public IgniteProductVersion version()

      Gets Ignite version.
      Specified by:
        `version` in interface `Ignite`
      Returns:
        Ignite version.

    - #### compute

          public IgniteCompute compute()

      Gets `compute` facade over all cluster nodes started in server mode.
      Specified by:
        `compute` in interface `Ignite`
      Returns:
        Compute instance over all cluster nodes started in server mode.

    - #### services

          public IgniteServices services()

      Gets `services` facade over all cluster nodes started in server mode.
      Specified by:
        `services` in interface `Ignite`
      Returns:
        Services facade over all cluster nodes started in server mode.

    - #### message

          public IgniteMessaging message()

      Gets `messaging` facade over all cluster nodes.
      Specified by:
        `message` in interface `Ignite`
      Returns:
        Messaging instance over all cluster nodes.

    - #### events

          public IgniteEvents events()

      Gets `events` facade over all cluster nodes.
      Specified by:
        `events` in interface `Ignite`
      Returns:
        Events instance over all cluster nodes.

    - #### executorService

          public ExecutorService executorService()

      Creates a new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on all cluster nodes. This essentially creates a Distributed Thread Pool that can be used as a replacement for local thread pools.
      Specified by:
        `executorService` in interface `Ignite`
      Returns:
        Grid-enabled `ExecutorService`.

    - #### cluster

          public IgniteCluster cluster()

      Gets an instance of `IgniteCluster` interface.
      Specified by:
        `cluster` in interface `Ignite`
      Returns:
        Instance of `IgniteCluster` interface.

    - #### compute

          public IgniteCompute compute(ClusterGroup grp)

      Gets `compute` facade over the specified cluster group. All operations on the returned `IgniteCompute` instance will only include nodes from this cluster group.
      Specified by:
        `compute` in interface `Ignite`
      Parameters:
        `grp` - Cluster group.
      Returns:
        Compute instance over given cluster group.

    - #### message

          public IgniteMessaging message(ClusterGroup prj)

      Gets `messaging` facade over nodes within the cluster group. All operations on the returned `IgniteMessaging` instance will only include nodes from the specified cluster group.
      Specified by:
        `message` in interface `Ignite`
      Parameters:
        `prj` - Cluster group.
      Returns:
        Messaging instance over given cluster group.

    - #### events

          public IgniteEvents events(ClusterGroup grp)

      Gets `events` facade over nodes within the cluster group. All operations on the returned `IgniteEvents` instance will only include nodes from the specified cluster group.
      Specified by:
        `events` in interface `Ignite`
      Parameters:
        `grp` - Cluster group.
      Returns:
        Events instance over given cluster group.

    - #### services

          public IgniteServices services(ClusterGroup grp)

      Gets `services` facade over nodes within the cluster group. All operations on the returned `IgniteMessaging` instance will only include nodes from the specified cluster group.
      Specified by:
        `services` in interface `Ignite`
      Parameters:
        `grp` - Cluster group.
      Returns:
        `Services` functionality over given cluster group.

    - #### executorService

          public ExecutorService executorService(ClusterGroup grp)

      Creates a new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on nodes in the specified cluster group. This essentially creates a Distributed Thread Pool that can be used as a replacement for local thread pools.
      Specified by:
        `executorService` in interface `Ignite`
      Parameters:
        `grp` - Cluster group.
      Returns:
        `ExecutorService` which will execute jobs on nodes in given cluster group.

    - #### scheduler

          public IgniteScheduler scheduler()

      Gets an instance of cron-based scheduler.
      Specified by:
        `scheduler` in interface `Ignite`
      Returns:
        Instance of scheduler.

    - #### name

          public String name()

      Gets the name of the Ignite instance. The name allows having multiple Ignite instances with different names within the same Java VM.

      If default Ignite instance is used, then `null` is returned. Refer to `Ignition` documentation for information on how to start named ignite Instances.

      Specified by:
        `name` in interface `Ignite`
      Returns:
        Name of the Ignite instance, or `null` for default Ignite instance.

    - #### resetLostPartitions

          public void resetLostPartitions(Collection<String> cacheNames)

      Clears partition's lost state and moves caches to a normal mode.

      To avoid permanent data loss for persistent caches it's recommended to return all previously failed baseline nodes to the topology before calling this method.

      Specified by:
        `resetLostPartitions` in interface `Ignite`
      Parameters:
        `cacheNames` - Name of the caches for which lost partitions is reset.

    - #### dataRegionMetrics

          public Collection<DataRegionMetrics> dataRegionMetrics()

      Returns a collection of `DataRegionMetrics` that reflects page memory usage on this Apache Ignite node instance. Returns the collection that contains the latest snapshots for each memory region configured with `configuration` on this Ignite node instance.
      Specified by:
        `dataRegionMetrics` in interface `Ignite`
      Returns:
        Collection of `DataRegionMetrics` snapshots.

    - #### dataRegionMetrics

          @Nullable
          public @Nullable DataRegionMetrics dataRegionMetrics(String memPlcName)

      Returns the latest `DataRegionMetrics` snapshot for the memory region of the given name. To get the metrics for the default memory region use `DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME` as the name or a custom name if the default memory region has been renamed.
      Specified by:
        `dataRegionMetrics` in interface `Ignite`
      Parameters:
        `memPlcName` - Name of memory region configured with `config`.
      Returns:
        `DataRegionMetrics` snapshot or `null` if no memory region is configured under specified name.

    - #### dataStorageMetrics

          public DataStorageMetrics dataStorageMetrics()

      Specified by:
        `dataStorageMetrics` in interface `Ignite`
      Returns:
        `DataStorageMetrics` snapshot.

    - #### encryption

          public IgniteEncryption encryption()

      Gets an instance of `IgniteEncryption` interface.
      Specified by:
        `encryption` in interface `Ignite`
      Returns:
        Instance of `IgniteEncryption` interface.

    - #### snapshot

          public IgniteSnapshot snapshot()

      Specified by:
        `snapshot` in interface `Ignite`
      Returns:
        Snapshot manager.

    - #### tracingConfiguration

          @NotNull
          public @NotNull TracingConfigurationManager tracingConfiguration()

      Returns the `TracingConfigurationManager` instance that allows to
      - Configure tracing parameters such as sampling rate for the specific tracing coordinates such as scope and label.
      - Retrieve the most specific tracing parameters for the specified tracing coordinates (scope and label)
      - Restore the tracing parameters for the specified tracing coordinates to the default.
      - List all pairs of tracing configuration coordinates and tracing configuration parameters.
      Specified by:
        `tracingConfiguration` in interface `Ignite`
      Returns:
        `TracingConfigurationManager` instance.

    - #### memoryMetrics

          public Collection<MemoryMetrics> memoryMetrics()

      Specified by:
        `memoryMetrics` in interface `Ignite`
      Returns:
        Collection of `MemoryMetrics` snapshots.

    - #### memoryMetrics

          @Nullable
          public @Nullable MemoryMetrics memoryMetrics(String memPlcName)

      Specified by:
        `memoryMetrics` in interface `Ignite`
      Parameters:
        `memPlcName` - Name of the data region.
      Returns:
        `MemoryMetrics` snapshot or `null` if no memory region is configured under specified name.

    - #### persistentStoreMetrics

          public PersistenceMetrics persistentStoreMetrics()

      Specified by:
        `persistentStoreMetrics` in interface `Ignite`
      Returns:
        `PersistenceMetrics` snapshot.

    - #### cache

          public <K,V> IgniteCache<K,V> cache(@Nullable
                                              @Nullable String name)

      Gets an instance of `IgniteCache` API for the given name if one is configured or `null` otherwise. `IgniteCache` is a fully-compatible implementation of `JCache (JSR 107)` specification.
      Specified by:
        `cache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `name` - Cache name.
      Returns:
        Instance of the cache for the specified name or `null` if one does not exist.

    - #### cacheNames

          public Collection<String> cacheNames()

      Gets the collection of names of currently available caches.
      Specified by:
        `cacheNames` in interface `Ignite`
      Returns:
        Collection of names of currently available caches or an empty collection if no caches are available.

    - #### createCache

          public <K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg)

      Dynamically starts new cache with the given cache configuration.

      If local node is an affinity node, this method will return the instance of started cache. Otherwise, it will create a client cache on local node.

      If a cache with the same name already exists in the grid, an exception will be thrown regardless whether the given configuration matches the configuration of the existing cache or not.

      Specified by:
        `createCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheCfg` - Cache configuration to use.
      Returns:
        Instance of started cache.

    - #### getOrCreateCache

          public <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg)

      Gets existing cache with the given name or creates new one with the given configuration.

      If a cache with the same name already exist, this method will not check that the given configuration matches the configuration of existing cache and will return an instance of the existing cache.

      Specified by:
        `getOrCreateCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheCfg` - Cache configuration to use.
      Returns:
        Existing or newly created cache.

    - #### createCache

          public <K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg,
                                                    NearCacheConfiguration<K,V> nearCfg)

      Dynamically starts new cache with the given cache configuration.

      If local node is an affinity node, this method will return the instance of started cache. Otherwise, it will create a near cache with the given configuration on local node.

      If a cache with the same name already exists in the grid, an exception will be thrown regardless whether the given configuration matches the configuration of the existing cache or not.

      Specified by:
        `createCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheCfg` - Cache configuration to use.
        `nearCfg` - Near cache configuration to use on local node in case it is not an affinity node.
      Returns:
        Instance of started cache.

    - #### createCaches

          public Collection<IgniteCache> createCaches(Collection<CacheConfiguration> cacheCfgs)

      Dynamically starts new caches with the given cache configurations.

      If local node is an affinity node, this method will return the instance of started caches. Otherwise, it will create a client caches on local node.

      If for one of configurations a cache with the same name already exists in the grid, an exception will be thrown regardless whether the given configuration matches the configuration of the existing cache or not.

      Specified by:
        `createCaches` in interface `Ignite`
      Parameters:
        `cacheCfgs` - Collection of cache configuration to use.
      Returns:
        Collection of instances of started caches.

    - #### getOrCreateCache

          public <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg,
                                                         NearCacheConfiguration<K,V> nearCfg)

      Gets existing cache with the given cache configuration or creates one if it does not exist.

      If a cache with the same name already exist, this method will not check that the given configuration matches the configuration of existing cache and will return an instance of the existing cache.

      If local node is not an affinity node and a client cache without near cache has been already started on this node, an exception will be thrown.

      Specified by:
        `getOrCreateCache` in interface `Ignite`
      Type Parameters:
        `K` - type.
        `V` - type.
      Parameters:
        `cacheCfg` - Cache configuration.
        `nearCfg` - Near cache configuration for client.
      Returns:
        `IgniteCache` instance.

    - #### createNearCache

          public <K,V> IgniteCache<K,V> createNearCache(String cacheName,
                                                        NearCacheConfiguration<K,V> nearCfg)

      Starts a near cache on local node if cache was previously started with one of the `Ignite.createCache(CacheConfiguration)` or `Ignite.createCache(CacheConfiguration, NearCacheConfiguration)` methods.
      Specified by:
        `createNearCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheName` - Cache name.
        `nearCfg` - Near cache configuration.
      Returns:
        Cache instance.

    - #### getOrCreateNearCache

          public <K,V> IgniteCache<K,V> getOrCreateNearCache(@Nullable
                                                             @Nullable String cacheName,
                                                             NearCacheConfiguration<K,V> nearCfg)

      Gets existing near cache with the given name or creates a new one.
      Specified by:
        `getOrCreateNearCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheName` - Cache name.
        `nearCfg` - Near configuration.
      Returns:
        `IgniteCache` instance.

    - #### getOrCreateCache

          public <K,V> IgniteCache<K,V> getOrCreateCache(String cacheName)

      Gets existing cache with the given name or creates new one using template configuration.
      Specified by:
        `getOrCreateCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheName` - Cache name.
      Returns:
        Existing or newly created cache.

    - #### getOrCreateCaches

          public Collection<IgniteCache> getOrCreateCaches(Collection<CacheConfiguration> cacheCfgs)

      Gets existing caches with the given name or created one with the given configuration.

      If a cache with the same name already exist, this method will not check that the given configuration matches the configuration of existing cache and will return an instance of the existing cache.

      Specified by:
        `getOrCreateCaches` in interface `Ignite`
      Parameters:
        `cacheCfgs` - Collection of cache configuration to use.
      Returns:
        Collection of existing or newly created caches.

    - #### createCache

          public <K,V> IgniteCache<K,V> createCache(String cacheName)

      Dynamically starts new cache using template configuration.

      If local node is an affinity node, this method will return the instance of started cache. Otherwise, it will create a client cache on local node.

      If a cache with the same name already exists in the grid, an exception will be thrown.

      Specified by:
        `createCache` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheName` - Cache name.
      Returns:
        Instance of started cache.

    - #### addCacheConfiguration

          public <K,V> void addCacheConfiguration(CacheConfiguration<K,V> cacheCfg)

      Adds cache configuration template.
      Specified by:
        `addCacheConfiguration` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheCfg` - Cache configuration template.

    - #### destroyCache

          public void destroyCache(String cacheName)

      Destroys a cache with the given name and cleans data that was written to the cache. The call will deallocate all resources associated with the given cache on all nodes in the cluster. There is no way to undo the action and recover destroyed data.

      All existing instances of `IgniteCache` will be invalidated, subsequent calls to the API will throw exceptions.

      If a cache with the specified name does not exist in the grid, the operation has no effect.

      Specified by:
        `destroyCache` in interface `Ignite`
      Parameters:
        `cacheName` - Cache name to destroy.

    - #### destroyCaches

          public void destroyCaches(Collection<String> cacheNames)

      Destroys caches with the given names and cleans data that was written to the caches. The call will deallocate all resources associated with the given caches on all nodes in the cluster. There is no way to undo the action and recover destroyed data.

      All existing instances of `IgniteCache` will be invalidated, subsequent calls to the API will throw exceptions.

      If the specified collection contains `null` or an empty value, this method will throw `IllegalArgumentException` and the caches will not be destroyed.

      If a cache with the specified name does not exist in the grid, the specified value will be skipped.

      Specified by:
        `destroyCaches` in interface `Ignite`
      Parameters:
        `cacheNames` - Collection of cache names to destroy.

    - #### transactions

          public IgniteTransactions transactions()

      Gets grid transactions facade.
      Specified by:
        `transactions` in interface `Ignite`
      Returns:
        Grid transactions facade.

    - #### dataStreamer

          public <K,V> IgniteDataStreamer<K,V> dataStreamer(@Nullable
                                                            @Nullable String cacheName)

      Gets a new instance of data streamer associated with given cache name. Data streamer is responsible for loading external data into in-memory data grid. For more information refer to `IgniteDataStreamer` documentation.
      Specified by:
        `dataStreamer` in interface `Ignite`
      Type Parameters:
        `K` - Type of the cache key.
        `V` - Type of the cache value.
      Parameters:
        `cacheName` - Cache name.
      Returns:
        Data streamer.

    - #### plugin

          public <T extends IgnitePlugin> T plugin(String name)
                                            throws PluginNotFoundException

      Gets an instance of deployed Ignite plugin.
      Specified by:
        `plugin` in interface `Ignite`
      Type Parameters:
        `T` - Plugin type.
      Parameters:
        `name` - Plugin name.
      Returns:
        Plugin instance.
      Throws:
        `PluginNotFoundException` - If plugin for the given name was not found.

    - #### binary

          public IgniteBinary binary()

      Gets an instance of `IgniteBinary` interface.
      Specified by:
        `binary` in interface `Ignite`
      Returns:
        Instance of `IgniteBinary` interface.

    - #### close

          public void close()
                     throws IgniteException

      Closes `this` instance of grid. This method is identical to calling `G.stop(igniteInstanceName, true)`.

      The method is invoked automatically on objects managed by the `try-with-resources` statement.

      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Ignite`
      Throws:
        `IgniteException` - If failed to stop grid.

    - #### atomicSequence

          @Nullable
          public @Nullable IgniteAtomicSequence atomicSequence(String name,
                                                                         long initVal,
                                                                         boolean create)

      Will get an atomic sequence from cache and create one if it has not been created yet and `create` flag is `true`. It will use configuration from `IgniteConfiguration.getAtomicConfiguration()`.
      Specified by:
        `atomicSequence` in interface `Ignite`
      Parameters:
        `name` - Sequence name.
        `initVal` - Initial value for sequence. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Sequence for the given name.

    - #### atomicSequence

          public IgniteAtomicSequence atomicSequence(String name,
                                                     AtomicConfiguration cfg,
                                                     long initVal,
                                                     boolean create)
                                              throws IgniteException

      Will get an atomic sequence from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicSequence` in interface `Ignite`
      Parameters:
        `name` - Sequence name.
        `cfg` - Configuration.
        `initVal` - Initial value for sequence. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Sequence for the given name.
      Throws:
        `IgniteException` - If sequence could not be fetched or created.

    - #### atomicLong

          @Nullable
          public @Nullable IgniteAtomicLong atomicLong(String name,
                                                                 long initVal,
                                                                 boolean create)

      Will get a atomic long from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicLong` in interface `Ignite`
      Parameters:
        `name` - Name of atomic long.
        `initVal` - Initial value for atomic long. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic long.

    - #### atomicLong

          public IgniteAtomicLong atomicLong(String name,
                                             AtomicConfiguration cfg,
                                             long initVal,
                                             boolean create)
                                      throws IgniteException

      Will get a atomic long from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicLong` in interface `Ignite`
      Parameters:
        `name` - Name of atomic long.
        `cfg` - Configuration.
        `initVal` - Initial value for atomic long. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic long.
      Throws:
        `IgniteException` - If atomic long could not be fetched or created.

    - #### atomicReference

          @Nullable
          public <T> @Nullable IgniteAtomicReference<T> atomicReference(String name,
                                                                                  @Nullable
                                                                                  T initVal,
                                                                                  boolean create)

      Will get a atomic reference from cache and create one if it has not been created yet and `create` flag is `true`. It will use configuration from `IgniteConfiguration.getAtomicConfiguration()`.
      Specified by:
        `atomicReference` in interface `Ignite`
      Type Parameters:
        `T` - Type of object referred to by this reference.
      Parameters:
        `name` - Atomic reference name.
        `initVal` - Initial value for atomic reference. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic reference for the given name.

    - #### atomicReference

          public <T> IgniteAtomicReference<T> atomicReference(String name,
                                                              AtomicConfiguration cfg,
                                                              @Nullable
                                                              T initVal,
                                                              boolean create)
                                                       throws IgniteException

      Will get a atomic reference from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicReference` in interface `Ignite`
      Type Parameters:
        `T` - Type of object referred to by this reference.
      Parameters:
        `name` - Atomic reference name.
        `cfg` - Configuration.
        `initVal` - Initial value for atomic reference. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic reference for the given name.
      Throws:
        `IgniteException` - If atomic reference could not be fetched or created.

    - #### atomicStamped

          @Nullable
          public <T,S> @Nullable IgniteAtomicStamped<T,S> atomicStamped(String name,
                                                                                  @Nullable
                                                                                  T initVal,
                                                                                  @Nullable
                                                                                  S initStamp,
                                                                                  boolean create)

      Will get a atomic stamped from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicStamped` in interface `Ignite`
      Type Parameters:
        `T` - Type of object referred to by this atomic.
        `S` - Type of stamp object.
      Parameters:
        `name` - Atomic stamped name.
        `initVal` - Initial value for atomic stamped. Ignored if `create` flag is `false`.
        `initStamp` - Initial stamp for atomic stamped. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic stamped for the given name.

    - #### atomicStamped

          public <T,S> IgniteAtomicStamped<T,S> atomicStamped(String name,
                                                              AtomicConfiguration cfg,
                                                              @Nullable
                                                              T initVal,
                                                              @Nullable
                                                              S initStamp,
                                                              boolean create)
                                                       throws IgniteException

      Will get a atomic stamped from cache and create one if it has not been created yet and `create` flag is `true`.
      Specified by:
        `atomicStamped` in interface `Ignite`
      Type Parameters:
        `T` - Type of object referred to by this atomic.
        `S` - Type of stamp object.
      Parameters:
        `name` - Atomic stamped name.
        `cfg` - Configuration.
        `initVal` - Initial value for atomic stamped. Ignored if `create` flag is `false`.
        `initStamp` - Initial stamp for atomic stamped. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Atomic stamped for the given name.
      Throws:
        `IgniteException` - If atomic stamped could not be fetched or created.

    - #### countDownLatch

          @Nullable
          public @Nullable IgniteCountDownLatch countDownLatch(String name,
                                                                         int cnt,
                                                                         boolean autoDel,
                                                                         boolean create)

      Gets or creates count down latch. If count down latch is not found in cache and `create` flag is `true`, it is created using provided name and count parameter.
      Specified by:
        `countDownLatch` in interface `Ignite`
      Parameters:
        `name` - Name of the latch.
        `cnt` - Count for new latch creation. Ignored if `create` flag is `false`.
        `autoDel` - `True` to automatically delete latch from cache when its count reaches zero. Ignored if `create` flag is `false`.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Count down latch for the given name.

    - #### semaphore

          @Nullable
          public @Nullable IgniteSemaphore semaphore(String name,
                                                               int cnt,
                                                               boolean failoverSafe,
                                                               boolean create)

      Gets or creates semaphore. If semaphore is not found in cache and `create` flag is `true`, it is created using provided name and count parameter.
      Specified by:
        `semaphore` in interface `Ignite`
      Parameters:
        `name` - Name of the semaphore.
        `cnt` - Count for new semaphore creation. Ignored if `create` flag is `false`.
        `failoverSafe` - `True` to create failover safe semaphore which means that if any node leaves topology permits already acquired by that node are silently released and become available for alive nodes to acquire. If flag is `false` then all threads waiting for available permits get interrupted.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        Semaphore for the given name.

    - #### reentrantLock

          @Nullable
          public @Nullable IgniteLock reentrantLock(String name,
                                                              boolean failoverSafe,
                                                              boolean fair,
                                                              boolean create)

      Gets or creates reentrant lock. If reentrant lock is not found in cache and `create` flag is `true`, it is created using provided name.
      Specified by:
        `reentrantLock` in interface `Ignite`
      Parameters:
        `name` - Name of the lock.
        `failoverSafe` - `True` to create failover safe lock which means that if any node leaves topology, all locks already acquired by that node are silently released and become available for other nodes to acquire. If flag is `false` then all threads on other nodes waiting to acquire lock are interrupted.
        `fair` - If `True`, fair lock will be created.
        `create` - Boolean flag indicating whether data structure should be created if does not exist.
      Returns:
        ReentrantLock for the given name.

    - #### queue

          @Nullable
          public <T> @Nullable IgniteQueue<T> queue(String name,
                                                              int cap,
                                                              CollectionConfiguration cfg)

      Will get a named queue from cache and create one if it has not been created yet and `cfg` is not `null`. If queue is present already, queue properties will not be changed. Use collocation for `CacheMode.PARTITIONED` caches if you have lots of relatively small queues as it will make fetching, querying, and iteration a lot faster. If you have few very large queues, then you should consider turning off collocation as they simply may not fit in a single node's memory.
      Specified by:
        `queue` in interface `Ignite`
      Type Parameters:
        `T` - Type of the elements in queue.
      Parameters:
        `name` - Name of queue.
        `cap` - Capacity of queue, `0` for unbounded queue. Ignored if `cfg` is `null`.
        `cfg` - Queue configuration if new queue should be created.
      Returns:
        Queue with given properties.

    - #### set

          @Nullable
          public <T> @Nullable IgniteSet<T> set(String name,
                                                          CollectionConfiguration cfg)

      Will get a named set from cache and create one if it has not been created yet and `cfg` is not `null`.
      Specified by:
        `set` in interface `Ignite`
      Type Parameters:
        `T` - Type of the elements in set.
      Parameters:
        `name` - Set name.
        `cfg` - Set configuration if new set should be created.
      Returns:
        Set with given properties.

    - #### affinity

          public <K> Affinity<K> affinity(String cacheName)

      Gets affinity service to provide information about data partitioning and distribution.
      Specified by:
        `affinity` in interface `Ignite`
      Type Parameters:
        `K` - Cache key type.
      Parameters:
        `cacheName` - Cache name.
      Returns:
        Affinity.

    - #### active

          public boolean active()

      Checks Ignite grid is active or not active.
      Specified by:
        `active` in interface `Ignite`
      Returns:
        `True` if grid is active. `False` If grid is not active.

    - #### active

          public void active(boolean active)

      Changes Ignite grid state to active or inactive.

      NOTE: Deactivation clears in-memory caches (without persistence) including the system caches.

      Specified by:
        `active` in interface `Ignite`
      Parameters:
        `active` - If `True` start activation process. If `False` start deactivation process.

    - #### writeExternal

          public void writeExternal(ObjectOutput out)
                             throws IOException

      Specified by:
        `writeExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### readExternal

          public void readExternal(ObjectInput in)
                            throws IOException,
                                   ClassNotFoundException

      Specified by:
        `readExternal` in interface `Externalizable`
      Throws:
        `IOException`
        `ClassNotFoundException`

    - #### checkIgnite

          protected void checkIgnite()
                              throws IllegalStateException

      Checks if this bean is valid.
      Throws:
        `IllegalStateException` - If bean is not valid, i.e. Ignite has already been stopped or has not yet been started.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022