Interface Ignite
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
IgniteSpringBean
public interface Ignite extends AutoCloseable
Main entry-point for all Ignite APIs. You can obtain an instance ofIgnite
throughIgnition.ignite()
, or for named grids you can useIgnition.ignite(String)
. Note that you can have multiple instances ofIgnite
running in the same VM by giving each instance a different name.Ignite provides the following functionality:
IgniteCluster
- clustering functionality.IgniteCache
- functionality for in-memory distributed cache, including SQL, TEXT, and Predicate-based queries.IgniteTransactions
- distributed ACID-compliant transactions.IgniteDataStreamer
- functionality for streaming large amounts of data into cache.IgniteCompute
- functionality for executing tasks and closures on all grid nodes (inherited formClusterGroup
).IgniteServices
- distributed service grid functionality (e.g. singletons on the cluster).IgniteMessaging
- functionality for topic-based message exchange on all grid nodes (inherited formClusterGroup
).IgniteEvents
- functionality for querying and listening to events on all grid nodes (inherited formClusterGroup
).ExecutorService
- distributed thread pools.IgniteAtomicLong
- distributed atomic long.IgniteAtomicReference
- distributed atomic reference.IgniteAtomicSequence
- distributed atomic sequence.IgniteAtomicStamped
- distributed atomic stamped reference.IgniteCountDownLatch
- distributed count down latch.IgniteQueue
- distributed blocking queue.IgniteSet
- distributed concurrent set.IgniteScheduler
- functionality for scheduling jobs using UNIX Cron syntax.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
active()
Deprecated.UseIgniteCluster.state()
instead.void
active(boolean active)
Deprecated.UseIgniteCluster.state(ClusterState)
instead.<K,V>
voidaddCacheConfiguration(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.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 andcreate
flag istrue
.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 andcreate
flag istrue
.<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 andcreate
flag istrue
.<T> 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 andcreate
flag istrue
.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 andcreate
flag istrue
.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 andcreate
flag istrue
.<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 andcreate
flag istrue
.<T,S>
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 andcreate
flag istrue
.IgniteBinary
binary()
Gets an instance ofIgniteBinary
interface.<K,V>
IgniteCache<K,V>cache(String name)
Gets an instance ofIgniteCache
API for the given name if one is configured ornull
otherwise.Collection<String>
cacheNames()
Gets the collection of names of currently available caches.void
close()
Closesthis
instance of grid.IgniteCluster
cluster()
Gets an instance ofIgniteCluster
interface.IgniteCompute
compute()
Getscompute
facade over all cluster nodes started in server mode.IgniteCompute
compute(ClusterGroup grp)
Getscompute
facade over the specified cluster group.IgniteConfiguration
configuration()
Gets the configuration of this Ignite instance.IgniteCountDownLatch
countDownLatch(String name, int cnt, boolean autoDel, boolean create)
Gets or creates count down latch.<K,V>
IgniteCache<K,V>createCache(String cacheName)
Dynamically starts new cache using template configuration.<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.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 thecreateCache(CacheConfiguration)
orcreateCache(CacheConfiguration, NearCacheConfiguration)
methods.Collection<DataRegionMetrics>
dataRegionMetrics()
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.@Nullable DataRegionMetrics
dataRegionMetrics(String memPlcName)
Returns the latestDataRegionMetrics
snapshot for the memory region of the given name.<K,V>
IgniteDataStreamer<K,V>dataStreamer(String cacheName)
Gets a new instance of data streamer associated with given cache name.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 ofIgniteEncryption
interface.IgniteEvents
events()
Getsevents
facade over all cluster nodes.IgniteEvents
events(ClusterGroup grp)
Getsevents
facade over nodes within the cluster group.ExecutorService
executorService()
Creates a newExecutorService
which will execute all submittedCallable
andRunnable
jobs on all cluster nodes.ExecutorService
executorService(ClusterGroup grp)
Creates a newExecutorService
which will execute all submittedCallable
andRunnable
jobs on nodes in the specified cluster group.<K,V>
IgniteCache<K,V>getOrCreateCache(String cacheName)
Gets existing cache with the given name or creates new one using template configuration.<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.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(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()
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.@Nullable MemoryMetrics
memoryMetrics(String dataRegionName)
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.IgniteMessaging
message()
Getsmessaging
facade over all cluster nodes.IgniteMessaging
message(ClusterGroup grp)
Getsmessaging
facade over nodes within the cluster group.IgniteMetrics
metrics()
Gets custom metrics facade over current node.String
name()
Gets the name of the Ignite instance.<T extends IgnitePlugin>
Tplugin(String name)
Gets an instance of deployed Ignite plugin.<T> IgniteQueue<T>
queue(String name, int cap, @Nullable CollectionConfiguration cfg)
Will get a named queue from cache and create one if it has not been created yet andcfg
is notnull
.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.IgniteSemaphore
semaphore(String name, int cnt, boolean failoverSafe, boolean create)
Gets or creates semaphore.IgniteServices
services()
Getsservices
facade over all cluster nodes started in server mode.IgniteServices
services(ClusterGroup grp)
Getsservices
facade over nodes within the cluster group.<T> IgniteSet<T>
set(String name, @Nullable CollectionConfiguration cfg)
Will get a named set from cache and create one if it has not been created yet andcfg
is notnull
.IgniteSnapshot
snapshot()
@NotNull TracingConfigurationManager
tracingConfiguration()
Returns theTracingConfigurationManager
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.IgniteTransactions
transactions()
Gets grid transactions facade.IgniteProductVersion
version()
Gets Ignite version.
-
-
-
Method Detail
-
name
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 toIgnition
documentation for information on how to start named ignite Instances.- Returns:
- Name of the Ignite instance, or
null
for default Ignite instance.
-
log
IgniteLogger log()
Gets grid's logger.- Returns:
- Grid's logger.
-
configuration
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.- Returns:
- Ignite configuration instance.
-
cluster
IgniteCluster cluster()
Gets an instance ofIgniteCluster
interface.- Returns:
- Instance of
IgniteCluster
interface.
-
compute
IgniteCompute compute()
Getscompute
facade over all cluster nodes started in server mode.- Returns:
- Compute instance over all cluster nodes started in server mode.
-
metrics
IgniteMetrics metrics()
Gets custom metrics facade over current node.- Returns:
IgniteMetrics
instance for current node.
-
compute
IgniteCompute compute(ClusterGroup grp)
Getscompute
facade over the specified cluster group. All operations on the returnedIgniteCompute
instance will only include nodes from this cluster group.- Parameters:
grp
- Cluster group.- Returns:
- Compute instance over given cluster group.
-
message
IgniteMessaging message()
Getsmessaging
facade over all cluster nodes.- Returns:
- Messaging instance over all cluster nodes.
-
message
IgniteMessaging message(ClusterGroup grp)
Getsmessaging
facade over nodes within the cluster group. All operations on the returnedIgniteMessaging
instance will only include nodes from the specified cluster group.- Parameters:
grp
- Cluster group.- Returns:
- Messaging instance over given cluster group.
-
events
IgniteEvents events()
Getsevents
facade over all cluster nodes.- Returns:
- Events instance over all cluster nodes.
-
events
IgniteEvents events(ClusterGroup grp)
Getsevents
facade over nodes within the cluster group. All operations on the returnedIgniteEvents
instance will only include nodes from the specified cluster group.- Parameters:
grp
- Cluster group.- Returns:
- Events instance over given cluster group.
-
services
IgniteServices services()
Getsservices
facade over all cluster nodes started in server mode.- Returns:
- Services facade over all cluster nodes started in server mode.
-
services
IgniteServices services(ClusterGroup grp)
Getsservices
facade over nodes within the cluster group. All operations on the returnedIgniteMessaging
instance will only include nodes from the specified cluster group.- Parameters:
grp
- Cluster group.- Returns:
Services
functionality over given cluster group.
-
executorService
ExecutorService executorService()
Creates a newExecutorService
which will execute all submittedCallable
andRunnable
jobs on all cluster nodes. This essentially creates a Distributed Thread Pool that can be used as a replacement for local thread pools.- Returns:
- Grid-enabled
ExecutorService
.
-
executorService
ExecutorService executorService(ClusterGroup grp)
Creates a newExecutorService
which will execute all submittedCallable
andRunnable
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.- Parameters:
grp
- Cluster group.- Returns:
ExecutorService
which will execute jobs on nodes in given cluster group.
-
version
IgniteProductVersion version()
Gets Ignite version.- Returns:
- Ignite version.
-
scheduler
IgniteScheduler scheduler()
Gets an instance of cron-based scheduler.- Returns:
- Instance of scheduler.
-
createCache
<K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg) throws javax.cache.CacheException
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.
- 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.
- Throws:
javax.cache.CacheException
- If a cache with the same name already exists or other error occurs.
-
createCaches
Collection<IgniteCache> createCaches(Collection<CacheConfiguration> cacheCfgs) throws javax.cache.CacheException
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.
- Parameters:
cacheCfgs
- Collection of cache configuration to use.- Returns:
- Collection of instances of started caches.
- Throws:
javax.cache.CacheException
- If one of created caches exists or other error occurs.
-
createCache
<K,V> IgniteCache<K,V> createCache(String cacheName) throws javax.cache.CacheException
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.
- Type Parameters:
K
- Type of the cache key.V
- Type of the cache value.- Parameters:
cacheName
- Cache name.- Returns:
- Instance of started cache.
- Throws:
javax.cache.CacheException
- If a cache with the same name already exists or other error occurs.
-
getOrCreateCache
<K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg) throws javax.cache.CacheException
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.
- 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.
- Throws:
javax.cache.CacheException
- If error occurs.
-
getOrCreateCache
<K,V> IgniteCache<K,V> getOrCreateCache(String cacheName) throws javax.cache.CacheException
Gets existing cache with the given name or creates new one using template configuration.- Type Parameters:
K
- Type of the cache key.V
- Type of the cache value.- Parameters:
cacheName
- Cache name.- Returns:
- Existing or newly created cache.
- Throws:
javax.cache.CacheException
- If error occurs.
-
getOrCreateCaches
Collection<IgniteCache> getOrCreateCaches(Collection<CacheConfiguration> cacheCfgs) throws javax.cache.CacheException
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.
- Parameters:
cacheCfgs
- Collection of cache configuration to use.- Returns:
- Collection of existing or newly created caches.
- Throws:
javax.cache.CacheException
- If error occurs.
-
addCacheConfiguration
<K,V> void addCacheConfiguration(CacheConfiguration<K,V> cacheCfg) throws javax.cache.CacheException
Adds cache configuration template.- Type Parameters:
K
- Type of the cache key.V
- Type of the cache value.- Parameters:
cacheCfg
- Cache configuration template.- Throws:
javax.cache.CacheException
- If error occurs.
-
createCache
<K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg) throws javax.cache.CacheException
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.
- 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.
- Throws:
javax.cache.CacheException
- If a cache with the same name already exists or other error occurs.
-
getOrCreateCache
<K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg) throws javax.cache.CacheException
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.
- Type Parameters:
K
- type.V
- type.- Parameters:
cacheCfg
- Cache configuration.nearCfg
- Near cache configuration for client.- Returns:
IgniteCache
instance.- Throws:
javax.cache.CacheException
- If error occurs.
-
createNearCache
<K,V> IgniteCache<K,V> createNearCache(String cacheName, NearCacheConfiguration<K,V> nearCfg) throws javax.cache.CacheException
Starts a near cache on local node if cache was previously started with one of thecreateCache(CacheConfiguration)
orcreateCache(CacheConfiguration, NearCacheConfiguration)
methods.- 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.
- Throws:
javax.cache.CacheException
- If error occurs.
-
getOrCreateNearCache
<K,V> IgniteCache<K,V> getOrCreateNearCache(String cacheName, NearCacheConfiguration<K,V> nearCfg) throws javax.cache.CacheException
Gets existing near cache with the given name or creates a new one.- Type Parameters:
K
- Type of the cache key.V
- Type of the cache value.- Parameters:
cacheName
- Cache name.nearCfg
- Near configuration.- Returns:
IgniteCache
instance.- Throws:
javax.cache.CacheException
- If error occurs.
-
destroyCache
void destroyCache(String cacheName) throws javax.cache.CacheException
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.
- Parameters:
cacheName
- Cache name to destroy.- Throws:
javax.cache.CacheException
- If error occurs.
-
destroyCaches
void destroyCaches(Collection<String> cacheNames) throws javax.cache.CacheException
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 throwIllegalArgumentException
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.
- Parameters:
cacheNames
- Collection of cache names to destroy.- Throws:
javax.cache.CacheException
- If error occurs.
-
cache
<K,V> IgniteCache<K,V> cache(String name) throws javax.cache.CacheException
Gets an instance ofIgniteCache
API for the given name if one is configured ornull
otherwise.IgniteCache
is a fully-compatible implementation ofJCache (JSR 107)
specification.- 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. - Throws:
javax.cache.CacheException
- If error occurs.
-
cacheNames
Collection<String> cacheNames()
Gets the collection of names of currently available caches.- Returns:
- Collection of names of currently available caches or an empty collection if no caches are available.
-
transactions
IgniteTransactions transactions()
Gets grid transactions facade.- Returns:
- Grid transactions facade.
-
dataStreamer
<K,V> IgniteDataStreamer<K,V> dataStreamer(String cacheName) throws IllegalStateException
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 toIgniteDataStreamer
documentation.- Type Parameters:
K
- Type of the cache key.V
- Type of the cache value.- Parameters:
cacheName
- Cache name.- Returns:
- Data streamer.
- Throws:
IllegalStateException
- If node is stopping.
-
atomicSequence
IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) throws IgniteException
Will get an atomic sequence from cache and create one if it has not been created yet andcreate
flag istrue
. It will use configuration fromIgniteConfiguration.getAtomicConfiguration()
.- Parameters:
name
- Sequence name.initVal
- Initial value for sequence. Ignored ifcreate
flag isfalse
.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.
-
atomicSequence
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 andcreate
flag istrue
.- Parameters:
name
- Sequence name.cfg
- Configuration.initVal
- Initial value for sequence. Ignored ifcreate
flag isfalse
.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
IgniteAtomicLong atomicLong(String name, long initVal, boolean create) throws IgniteException
Will get a atomic long from cache and create one if it has not been created yet andcreate
flag istrue
.- Parameters:
name
- Name of atomic long.initVal
- Initial value for atomic long. Ignored ifcreate
flag isfalse
.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.
-
atomicLong
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 andcreate
flag istrue
.- Parameters:
name
- Name of atomic long.cfg
- Configuration.initVal
- Initial value for atomic long. Ignored ifcreate
flag isfalse
.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
<T> IgniteAtomicReference<T> atomicReference(String name, @Nullable T initVal, boolean create) throws IgniteException
Will get a atomic reference from cache and create one if it has not been created yet andcreate
flag istrue
. It will use configuration fromIgniteConfiguration.getAtomicConfiguration()
.- Type Parameters:
T
- Type of object referred to by this reference.- Parameters:
name
- Atomic reference name.initVal
- Initial value for atomic reference. Ignored ifcreate
flag isfalse
.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.
-
atomicReference
<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 andcreate
flag istrue
.- 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 ifcreate
flag isfalse
.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
<T,S> IgniteAtomicStamped<T,S> atomicStamped(String name, @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 andcreate
flag istrue
.- 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 ifcreate
flag isfalse
.initStamp
- Initial stamp for atomic stamped. Ignored ifcreate
flag isfalse
.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.
-
atomicStamped
<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 andcreate
flag istrue
.- 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 ifcreate
flag isfalse
.initStamp
- Initial stamp for atomic stamped. Ignored ifcreate
flag isfalse
.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
IgniteCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create) throws IgniteException
Gets or creates count down latch. If count down latch is not found in cache andcreate
flag istrue
, it is created using provided name and count parameter.- Parameters:
name
- Name of the latch.cnt
- Count for new latch creation. Ignored ifcreate
flag isfalse
.autoDel
-True
to automatically delete latch from cache when its count reaches zero. Ignored ifcreate
flag isfalse
.create
- Boolean flag indicating whether data structure should be created if does not exist.- Returns:
- Count down latch for the given name.
- Throws:
IgniteException
- If latch could not be fetched or created.
-
semaphore
IgniteSemaphore semaphore(String name, int cnt, boolean failoverSafe, boolean create) throws IgniteException
Gets or creates semaphore. If semaphore is not found in cache andcreate
flag istrue
, it is created using provided name and count parameter.- Parameters:
name
- Name of the semaphore.cnt
- Count for new semaphore creation. Ignored ifcreate
flag isfalse
.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 isfalse
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.
- Throws:
IgniteException
- If semaphore could not be fetched or created.
-
reentrantLock
IgniteLock reentrantLock(String name, boolean failoverSafe, boolean fair, boolean create) throws IgniteException
Gets or creates reentrant lock. If reentrant lock is not found in cache andcreate
flag istrue
, it is created using provided name.- 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 isfalse
then all threads on other nodes waiting to acquire lock are interrupted.fair
- IfTrue
, 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.
- Throws:
IgniteException
- If reentrant lock could not be fetched or created.
-
queue
<T> IgniteQueue<T> queue(String name, int cap, @Nullable @Nullable CollectionConfiguration cfg) throws IgniteException
Will get a named queue from cache and create one if it has not been created yet andcfg
is notnull
. If queue is present already, queue properties will not be changed. Use collocation forCacheMode.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.- Type Parameters:
T
- Type of the elements in queue.- Parameters:
name
- Name of queue.cap
- Capacity of queue,0
for unbounded queue. Ignored ifcfg
isnull
.cfg
- Queue configuration if new queue should be created.- Returns:
- Queue with given properties.
- Throws:
IgniteException
- If queue could not be fetched or created.
-
set
<T> IgniteSet<T> set(String name, @Nullable @Nullable CollectionConfiguration cfg) throws IgniteException
Will get a named set from cache and create one if it has not been created yet andcfg
is notnull
.- 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.
- Throws:
IgniteException
- If set could not be fetched or created.
-
plugin
<T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException
Gets an instance of deployed Ignite plugin.- Type Parameters:
T
- Plugin type.- Parameters:
name
- Plugin name.- Returns:
- Plugin instance.
- Throws:
PluginNotFoundException
- If plugin for the given name was not found.
-
binary
IgniteBinary binary()
Gets an instance ofIgniteBinary
interface.- Returns:
- Instance of
IgniteBinary
interface.
-
close
void close() throws IgniteException
Closesthis
instance of grid. This method is identical to callingG.stop(igniteInstanceName, true)
.The method is invoked automatically on objects managed by the
try-with-resources
statement.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IgniteException
- If failed to stop grid.
-
affinity
<K> Affinity<K> affinity(String cacheName)
Gets affinity service to provide information about data partitioning and distribution.- Type Parameters:
K
- Cache key type.- Parameters:
cacheName
- Cache name.- Returns:
- Affinity.
-
active
@Deprecated boolean active()
Deprecated.UseIgniteCluster.state()
instead.Checks Ignite grid is active or not active.- Returns:
True
if grid is active.False
If grid is not active.
-
active
@Deprecated void active(boolean active)
Deprecated.UseIgniteCluster.state(ClusterState)
instead.Changes Ignite grid state to active or inactive.NOTE: Deactivation clears in-memory caches (without persistence) including the system caches.
- Parameters:
active
- IfTrue
start activation process. IfFalse
start deactivation process.- Throws:
IgniteException
- If there is an already started transaction or lock in the same thread.
-
resetLostPartitions
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.
- Parameters:
cacheNames
- Name of the caches for which lost partitions is reset.
-
memoryMetrics
@Deprecated Collection<MemoryMetrics> memoryMetrics()
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.{data_region_name}" instead.- Returns:
- Collection of
MemoryMetrics
snapshots.
-
memoryMetrics
@Deprecated @Nullable @Nullable MemoryMetrics memoryMetrics(String dataRegionName)
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.{data_region_name}" instead.- Parameters:
dataRegionName
- Name of the data region.- Returns:
MemoryMetrics
snapshot ornull
if no memory region is configured under specified name.
-
dataRegionMetrics
Collection<DataRegionMetrics> dataRegionMetrics()
Deprecated.Check theReadOnlyMetricRegistry
with "name=io.dataregion.{data_region_name}" instead.Returns a collection ofDataRegionMetrics
that reflects page memory usage on this Apache Ignite node instance. Returns the collection that contains the latest snapshots for each memory region configured withconfiguration
on this Ignite node instance.- Returns:
- Collection of
DataRegionMetrics
snapshots.
-
dataRegionMetrics
@Nullable @Nullable DataRegionMetrics dataRegionMetrics(String memPlcName)
Returns the latestDataRegionMetrics
snapshot for the memory region of the given name. To get the metrics for the default memory region useDataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME
as the name or a custom name if the default memory region has been renamed.- Parameters:
memPlcName
- Name of memory region configured withconfig
.- Returns:
DataRegionMetrics
snapshot ornull
if no memory region is configured under specified name.
-
encryption
IgniteEncryption encryption()
Gets an instance ofIgniteEncryption
interface.- Returns:
- Instance of
IgniteEncryption
interface.
-
snapshot
IgniteSnapshot snapshot()
- Returns:
- Snapshot manager.
-
tracingConfiguration
@NotNull @NotNull TracingConfigurationManager tracingConfiguration()
Returns theTracingConfigurationManager
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.
- Returns:
TracingConfigurationManager
instance.
-
-