org.apache.ignite

## Interface Ignite

All Superinterfaces:
  AutoCloseable

All Known Subinterfaces:
  IgniteEx

All Known Implementing Classes:
  IgniteKernal

    public interface Ignite
    extends AutoCloseable

Main entry-point for all Ignite APIs. You can obtain an instance of `Grid` through `Ignition.ignite()`, or for named grids you can use `Ignition.ignite(String)`. Note that you can have multiple instances of `Grid` running in the same VM by giving each instance a different name.

Note that `Grid` extends `ClusterGroup` which means that it provides grid projection functionality over the whole grid (instead os a subgroup of nodes).

In addition to `ClusterGroup` functionality, from here you can get the following:

- `GridCache` - functionality for in-memory distributed cache.
- `IgniteDataLoader` - functionality for loading data large amounts of data into cache.
- `IgniteFs` - functionality for distributed Hadoop-compliant in-memory file system and map-reduce.
- `IgniteStreamer` - functionality for streaming events workflow with queries and indexes into rolling windows.
- `IgniteScheduler` - functionality for scheduling jobs using UNIX Cron syntax.
- `IgniteCompute` - functionality for executing tasks and closures on all grid nodes (inherited form `ClusterGroup`).
- `IgniteMessaging` - functionality for topic-based message exchange on all grid nodes (inherited form `ClusterGroup`).
- `IgniteEvents` - functionality for querying and listening to events on all grid nodes (inherited form `ClusterGroup`).

### Method Summary

Methods
`<K> CacheAffinity<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 and `create` flag is `true`.
`<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 and `create` flag is `true`.
`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, 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`.
`void` `close()` Closes `this` instance of grid.
`IgniteCluster` `cluster()` Gets an instance of `IgniteCluster` interface.
`IgniteCompute` `compute()` Gets `compute` functionality over this grid projection.
`IgniteCompute` `compute(ClusterGroup grp)`
`IgniteConfiguration` `configuration()` Gets the configuration of this grid instance.
`IgniteCountDownLatch` `countDownLatch(String name, int cnt, boolean autoDel, boolean create)` Gets or creates count down latch.
`<K,V> IgniteDataLoader<K,V>` `dataLoader(String cacheName)` Gets a new instance of data loader associated with given cache name.
`IgniteEvents` `events()` Gets `events` functionality over this grid projection.
`IgniteEvents` `events(ClusterGroup grp)`
`ExecutorService` `executorService()` Creates new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on nodes in this grid projection.
`ExecutorService` `executorService(ClusterGroup grp)`
`IgniteFs` `fileSystem(String name)` Gets an instance of IGFS - Ignite In-Memory File System, if one is not configured then `IllegalArgumentException` will be thrown.
`Collection<IgniteFs>` `fileSystems()` Gets all instances of the grid file systems.
`<K,V> IgniteCache<K,V>` `jcache(String name)` Gets an instance of `IgniteCache` API.
`IgniteLogger` `log()` Gets grid's logger.
`IgniteMessaging` `message()` Gets `messaging` functionality over this grid projection.
`IgniteMessaging` `message(ClusterGroup grp)`
`String` `name()` Gets the name of the grid this grid instance (and correspondingly its local node) belongs to.
`<T extends IgnitePlugin> T` `plugin(String name)` Gets an instance of deployed Ignite plugin.
`<T> 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`.
`IgniteScheduler` `scheduler()` Gets an instance of cron-based scheduler.
`IgniteServices` `services()` Gets `services` functionality over this grid projection.
`IgniteServices` `services(ClusterGroup grp)`
`<T> 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`.
`IgniteStreamer` `streamer(String name)` Gets an instance of streamer by name, if one does not exist then `IllegalArgumentException` will be thrown.
`Collection<IgniteStreamer>` `streamers()` Gets all instances of streamers.
`IgniteTransactions` `transactions()` Gets grid transactions facade.
`IgniteProductVersion` `version()` Gets Ignite version.

### Method Detail

#### name

    String name()

Gets the name of the grid this grid instance (and correspondingly its local node) belongs to. Note that single Java VM can have multiple grid instances all belonging to different grids. Grid name allows to indicate to what grid this particular grid instance (i.e. grid runtime and its local node) belongs to.

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

Returns:
  Name of the grid, or `null` for default grid.

#### log

    IgniteLogger log()

Gets grid's logger.

Returns:
  Grid's logger.

#### configuration

    IgniteConfiguration configuration()

Gets the configuration of this grid 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:
  Grid configuration instance.

#### cluster

    IgniteCluster cluster()

Gets an instance of `IgniteCluster` interface.

Returns:
  Instance of `IgniteCluster` interface.

#### compute

    IgniteCompute compute()

Gets `compute` functionality over this grid projection. All operations on the returned `IgniteCompute` instance will only include nodes from this projection.

Returns:
  Compute instance over this grid projection.

#### compute

    IgniteCompute compute(ClusterGroup grp)

Parameters:
  `grp` - Cluster group..
Returns:
  Compute instance over given cluster group.

#### message

    IgniteMessaging message()

Gets `messaging` functionality over this grid projection. All operations on the returned `IgniteMessaging` instance will only include nodes from this projection.

Returns:
  Messaging instance over this grid projection.

#### message

    IgniteMessaging message(ClusterGroup grp)

Parameters:
  `grp` - Cluster group.
Returns:
  Messaging instance over given cluster group.

#### events

    IgniteEvents events()

Gets `events` functionality over this grid projection. All operations on the returned `IgniteEvents` instance will only include nodes from this projection.

Returns:
  Events instance over this grid projection.

#### events

    IgniteEvents events(ClusterGroup grp)

Parameters:
  `grp` - Cluster group.
Returns:
  Events instance over given cluster group.

#### services

    IgniteServices services()

Gets `services` functionality over this grid projection. All operations on the returned `IgniteMessaging` instance will only include nodes from this projection.

Returns:
  Services instance over this grid projection.

#### services

    IgniteServices services(ClusterGroup grp)

Parameters:
  `grp` - Cluster group.
Returns:
  `Services` functionality over given cluster group.

#### executorService

    ExecutorService executorService()

Creates new `ExecutorService` which will execute all submitted `Callable` and `Runnable` jobs on nodes in this grid projection. This essentially creates a Distributed Thread Pool</i</b> that can be used as a replacement for local thread pools.

Returns:
  Grid-enabled `ExecutorService`.

#### executorService

    ExecutorService executorService(ClusterGroup grp)

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.

#### jcache

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

Gets an instance of `IgniteCache` API. `IgniteCache` is a fully-compatible implementation of `JCache (JSR 107)` specification.

Parameters:
  `name` - Cache name.
Returns:
  Instance of the cache for the specified name.

#### transactions

    IgniteTransactions transactions()

Gets grid transactions facade.

Returns:
  Grid transactions facade.

#### dataLoader

    <K,V> IgniteDataLoader<K,V> dataLoader(@Nullable
                                         String cacheName)

Gets a new instance of data loader associated with given cache name. Data loader is responsible for loading external data into in-memory data grid. For more information refer to `IgniteDataLoader` documentation.

Parameters:
  `cacheName` - Cache name (`null` for default cache).
Returns:
  Data loader.

#### fileSystem

    IgniteFs fileSystem(String name)

Gets an instance of IGFS - Ignite In-Memory File System, if one is not configured then `IllegalArgumentException` will be thrown.

IGFS is fully compliant with Hadoop `FileSystem` APIs and can be plugged into Hadoop installations. For more information refer to documentation on Hadoop integration shipped with Ignite.

Parameters:
  `name` - IGFS name.
Returns:
  IGFS instance.

#### fileSystems

    Collection<IgniteFs> fileSystems()

Gets all instances of the grid file systems.

Returns:
  Collection of grid file systems instances.

#### streamer

    IgniteStreamer streamer(@Nullable
                          String name)

Gets an instance of streamer by name, if one does not exist then `IllegalArgumentException` will be thrown.

Parameters:
  `name` - Streamer name.
Returns:
  Streamer for given name.

#### streamers

    Collection<IgniteStreamer> streamers()

Gets all instances of streamers.

Returns:
  Collection of all streamer instances.

#### 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 and `create` flag is `true`.

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.
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 and `create` flag is `true`.

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.
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 and `create` flag is `true`.

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.
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 and `create` flag is `true`.

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.
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 and `create` flag is `true`, it is created using provided name and count parameter.

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.
Throws:
  `IgniteException` - If latch could not be fetched or created.

#### queue

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

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.

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.
Throws:
  `IgniteException` - If queue could not be fetched or created.

#### set

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

Will get a named set from cache and create one if it has not been created yet and `cfg` is not `null`.

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.

#### close

    void close()
               throws IgniteException

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

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

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

#### affinity

    <K> CacheAffinity<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.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015