org.apache.ignite.internal

## Class IgniteKernal

- java.lang.Object
- - org.apache.ignite.internal.ClusterGroupAdapter
  - - org.apache.ignite.internal.IgniteKernal

All Implemented Interfaces:
  Externalizable, Serializable, AutoCloseable, ClusterGroup, Ignite, IgniteCluster, ClusterGroupEx, IgniteEx, IgniteAsyncSupport, IgniteMXBean

    public class IgniteKernal
    extends ClusterGroupAdapter
    implements IgniteEx, IgniteMXBean

Ignite kernal.

See http://en.wikipedia.org/wiki/Kernal for information on the misspelling.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.ClusterGroupAdapter

`ctx, p`

### Constructor Summary

Constructors
Constructor and Description
`IgniteKernal()` No-arg constructor is required by externalization.
`IgniteKernal(GridSpringResourceContext rsrcCtx)`

### Method Summary

Methods
`<K> CacheAffinity<K>` `affinity(String cacheName)` Gets affinity service to provide information about data partitioning and distribution.
`boolean` `allEventsUserRecordable(int[] types)` Checks whether all provided events are user-recordable.
`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`.
`<K,V> GridCache<K,V>` `cache(String name)`
`Collection<GridCache<?,?>>` `caches()`
`Collection<GridCache<?,?>>` `cachesx(IgnitePredicate<? super GridCache<?,?>>[] p)` Gets configured cache instance that satisfy all provided predicates including non-public caches.
`<K,V> GridCache<K,V>` `cachex()` Gets default cache instance if one is configured or `null` otherwise returning even non-public caches.
`<K,V> GridCache<K,V>` `cachex(String name)` Gets the cache instance for the given name if one is configured or `null` otherwise returning even non-public caches.
`void` `close()` Closes `this` instance of grid.
`IgniteCluster` `cluster()` Gets an instance of `IgniteCluster` interface.
`Collection<String>` `compatibleVersions()` Gets list of compatible versions.
`IgniteCompute` `compute(ClusterGroup grp)`
`IgniteConfiguration` `configuration()` Gets the configuration of this grid instance.
`GridKernalContext` `context()` It's intended for use by internal marshalling implementation only.
`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(ClusterGroup grp)`
`boolean` `eventUserRecordable(int type)` Checks if the event type is user-recordable.
`String` `executeTask(String taskName, String arg)` A shortcut method that executes given task assuming single `java.lang.String` argument and `java.lang.String` return type.
`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.
`ClusterGroup` `forLocal()` Gets monadic projection consisting from the local node.
`<R> IgniteFuture<R>` `future()` Gets and resets future for previous asynchronous operation.
`String` `getCheckpointSpiFormatted()` Gets a formatted instance of configured checkpoint SPI implementation.
`String` `getCollisionSpiFormatted()` Gets a formatted instance of configured collision SPI implementations.
`String` `getCommunicationSpiFormatted()` Gets a formatted instance of fully configured SPI communication implementation.
`String` `getCopyright()` Gets copyright statement for Ignite product.
`String` `getDeploymentSpiFormatted()` Gets a formatted instance of fully configured deployment SPI implementation.
`String` `getDiscoverySpiFormatted()` Gets a formatted instance of configured discovery SPI implementation.
`String` `getEventStorageSpiFormatted()` Gets a formatted instance of fully configured event SPI implementation.
`String` `getExecutorServiceFormatted()` Gets a formatted instance of fully configured thread pool that is used in grid.
`String` `getFailoverSpiFormatted()` Gets a formatted instance of fully configured failover SPI implementations.
`String` `getFullVersion()` Gets string presentation of the version.
`String` `getGridLoggerFormatted()` Gets a formatted instance of logger that is in grid.
`String` `getIgniteHome()` Gets Ignite installation home folder.
`String` `getInstanceName()` Gets optional kernal instance name.
`String` `getJdkInformation()` Gets JDK information.
`Collection<String>` `getLifecycleBeansFormatted()` Gets `toString()` representation of of lifecycle beans configured with Ignite.
`String` `getLoadBalancingSpiFormatted()` Gets a formatted instance of fully configured load balancing SPI implementations.
`UUID` `getLocalNodeId()` Unique identifier for this node within grid.
`String` `getMBeanServerFormatted()` Gets a formatted instance of MBean server instance.
`String` `getOsInformation()` Gets OS information.
`String` `getOsUser()` Gets OS user.
`long` `getStartTimestamp()` Get start timestamp of the kernal.
`String` `getStartTimestampFormatted()` Gets string presentation of the kernal start timestamp.
`String` `getSwapSpaceSpiFormatted()` Gets a formatted instance of configured swapspace SPI implementations.
`long` `getUpTime()` Gets up-time of the kernal.
`String` `getUpTimeFormatted()` Gets string presentation of up-time for the kernal.
`Collection<String>` `getUserAttributesFormatted()` Gets a collection of formatted user-defined attributes added to this node.
`String` `getVmName()` Gets VM name.
`GridHadoop` `hadoop()` Get Hadoop facade.
`IgniteFs` `igfsx(String name)` Get IGFS instance returning null if it doesn't exist.
`<K,V> GridCacheAdapter<K,V>` `internalCache()` USED ONLY FOR TESTING.
`<K,V> GridCacheAdapter<K,V>` `internalCache(String name)` USED ONLY FOR TESTING.
`boolean` `isAsync()`
`boolean` `isJmxRemoteEnabled()` Whether or not remote JMX management is enabled for this node.
`boolean` `isPeerClassLoadingEnabled()` Returns `true` if peer class loading is enabled, `false` otherwise.
`boolean` `isRestartEnabled()` Whether or not node restart is enabled.
`<K,V> IgniteCache<K,V>` `jcache(String name)` Gets an instance of `IgniteCache` API.
`String` `latestVersion()` Get latest version in string form.
`ClusterNode` `localNode()` Gets local grid node.
`IgniteLogger` `log()` Gets grid's logger.
`<K> Map<ClusterNode,Collection<K>>` `mapKeysToNodes(String cacheName, Collection<? extends K> keys)` This method provides ability to detect which cache keys are mapped to which nodes on cache instance with given name.
`<K> ClusterNode` `mapKeyToNode(String cacheName, K key)` This method provides ability to detect which cache keys are mapped to which nodes on cache instance with given name.
`IgniteMessaging` `message(ClusterGroup prj)`
`String` `name()` Gets the name of the grid this grid instance (and correspondingly its local node) belongs to.
`<K,V> ClusterNodeLocalMap<K,V>` `nodeLocalMap()` Gets node-local storage instance.
`boolean` `pingNode(String nodeId)` Pings node with given node ID to see whether it is alive.
`boolean` `pingNode(UUID nodeId)` Pings a remote node.
`boolean` `pingNodeByAddress(String host)` Pings node with given host name to see if it is alive.
`<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`.
`boolean` `removeCheckpoint(String key)` This method allows manually remove the checkpoint with given `key`.
`void` `resetMetrics()` Resets local I/O, job, and task execution metrics.
`void` `restartNodes()` Restarts nodes satisfying optional set of predicates.
`void` `restartNodes(Collection<UUID> ids)` Restarts nodes defined by provided IDs.
`IgniteScheduler` `scheduler()` Gets an instance of cron-based scheduler.
`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`.
`void` `start(IgniteConfiguration cfg, ExecutorService utilityCachePool, ExecutorService execSvc, ExecutorService sysExecSvc, ExecutorService p2pExecSvc, ExecutorService mgmtExecSvc, ExecutorService igfsExecSvc, ExecutorService restExecSvc, GridAbsClosure errHnd)`
`Collection<GridTuple3<String,Boolean,String>>` `startNodes(Collection<Map<String,Object>> hosts, Map<String,Object> dflts, boolean restart, int timeout, int maxConn)` Starts one or more nodes on remote host(s).
`Collection<GridTuple3<String,Boolean,String>>` `startNodes(File file, boolean restart, int timeout, int maxConn)` Starts one or more nodes on remote host(s).
`void` `stop(boolean cancel)` Stops grid instance.
`void` `stopNodes()` Stops nodes satisfying optional set of predicates.
`void` `stopNodes(Collection<UUID> ids)` Stops nodes defined by provided IDs.
`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.
`Collection<ClusterNode>` `topology(long topVer)` Gets a topology by version.
`long` `topologyVersion()` Gets current topology version.
`String` `toString()`
`IgniteTransactions` `transactions()` Gets grid transactions facade.
`void` `undeployTaskFromGrid(String taskName)` Makes the best attempt to undeploy a task from the whole grid.
`<K extends GridCacheUtilityKey,V> GridCacheProjectionEx<K,V>` `utilityCache(Class<K> keyCls, Class<V> valCls)` Gets utility cache.
`IgniteProductVersion` `version()` Gets Ignite version.
`IgniteCluster` `withAsync()` Gets component with asynchronous mode enabled.

### Methods inherited from class org.apache.ignite.internal.ClusterGroupAdapter

`compute, events, executorService, forAttribute, forCacheNodes, forCacheNodes, forClientNodes, forDaemons, forDataNodes, forHost, forNode, forNodeId, forNodeIds, forNodes, forOldest, forOthers, forOthers, forPredicate, forRandom, forRemotes, forStreamer, forSubjectId, forYoungest, guard, ignite, lightCheck, message, metrics, node, node, nodes, predicate, readExternal, readResolve, services, setKernalContext, unguard, writeExternal`

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

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

### Methods inherited from interface org.apache.ignite.Ignite

`compute, events, executorService, message, services`

### Methods inherited from interface org.apache.ignite.internal.ClusterGroupEx

`forCacheNodes, forSubjectId`

### Methods inherited from interface org.apache.ignite.cluster.ClusterGroup

`forAttribute, forCacheNodes, forClientNodes, forDaemons, forDataNodes, forHost, forNode, forNodeId, forNodeIds, forNodes, forOldest, forOthers, forOthers, forPredicate, forRandom, forRemotes, forStreamer, forYoungest, ignite, metrics, node, node, nodes, predicate`

### Constructor Detail

#### IgniteKernal

    public IgniteKernal()

No-arg constructor is required by externalization.

#### IgniteKernal

    public IgniteKernal(@Nullable
                GridSpringResourceContext rsrcCtx)

Parameters:
  `rsrcCtx` - Optional Spring application context.

### Method Detail

#### cluster

    public IgniteCluster cluster()

Gets an instance of `IgniteCluster` interface.

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

#### compute

    public final IgniteCompute compute(ClusterGroup grp)

Specified by:
  `compute` in interface `Ignite`
Parameters:
  `grp` - Cluster group..
Returns:
  Compute instance over given cluster group.

#### message

    public final IgniteMessaging message(ClusterGroup prj)

Specified by:
  `message` in interface `Ignite`
Parameters:
  `prj` - Cluster group.
Returns:
  Messaging instance over given cluster group.

#### events

    public final IgniteEvents events(ClusterGroup grp)

Specified by:
  `events` in interface `Ignite`
Parameters:
  `grp` - Cluster group.
Returns:
  Events instance over given cluster group.

#### services

    public IgniteServices services(ClusterGroup grp)

Specified by:
  `services` in interface `Ignite`
Parameters:
  `grp` - Cluster group.
Returns:
  `Services` functionality over given cluster group.

#### executorService

    public ExecutorService executorService(ClusterGroup grp)

Specified by:
  `executorService` in interface `Ignite`
Parameters:
  `grp` - Cluster group.
Returns:
  `ExecutorService` which will execute jobs on nodes in given cluster group.

#### name

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

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

#### getCopyright

    public String getCopyright()

Gets copyright statement for Ignite product.

Specified by:
  `getCopyright` in interface `IgniteMXBean`
Returns:
  Copyright statement for Ignite product.

#### getStartTimestamp

    public long getStartTimestamp()

Get start timestamp of the kernal.

Specified by:
  `getStartTimestamp` in interface `IgniteMXBean`
Returns:
  Start timestamp of the kernal.

#### getStartTimestampFormatted

    public String getStartTimestampFormatted()

Gets string presentation of the kernal start timestamp.

Specified by:
  `getStartTimestampFormatted` in interface `IgniteMXBean`
Returns:
  String presentation of the kernal start timestamp.

#### getUpTime

    public long getUpTime()

Gets up-time of the kernal.

Specified by:
  `getUpTime` in interface `IgniteMXBean`
Returns:
  Up-time of the kernal.

#### getUpTimeFormatted

    public String getUpTimeFormatted()

Gets string presentation of up-time for the kernal.

Specified by:
  `getUpTimeFormatted` in interface `IgniteMXBean`
Returns:
  String presentation of up-time for the kernal.

#### getFullVersion

    public String getFullVersion()

Gets string presentation of the version.

Specified by:
  `getFullVersion` in interface `IgniteMXBean`
Returns:
  String presentation of the version.

#### getCheckpointSpiFormatted

    public String getCheckpointSpiFormatted()

Gets a formatted instance of configured checkpoint SPI implementation.

Specified by:
  `getCheckpointSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid checkpoint SPI implementation.

#### getSwapSpaceSpiFormatted

    public String getSwapSpaceSpiFormatted()

Gets a formatted instance of configured swapspace SPI implementations.

Specified by:
  `getSwapSpaceSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid swapspace SPI implementations.

#### getCommunicationSpiFormatted

    public String getCommunicationSpiFormatted()

Gets a formatted instance of fully configured SPI communication implementation.

Specified by:
  `getCommunicationSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid communication SPI implementation.

#### getDeploymentSpiFormatted

    public String getDeploymentSpiFormatted()

Gets a formatted instance of fully configured deployment SPI implementation.

Specified by:
  `getDeploymentSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid deployment SPI implementation.

#### getDiscoverySpiFormatted

    public String getDiscoverySpiFormatted()

Gets a formatted instance of configured discovery SPI implementation.

Specified by:
  `getDiscoverySpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid discovery SPI implementation.

#### getEventStorageSpiFormatted

    public String getEventStorageSpiFormatted()

Gets a formatted instance of fully configured event SPI implementation.

Specified by:
  `getEventStorageSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid event SPI implementation.

#### getCollisionSpiFormatted

    public String getCollisionSpiFormatted()

Gets a formatted instance of configured collision SPI implementations.

Specified by:
  `getCollisionSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid collision SPI implementations.

#### getFailoverSpiFormatted

    public String getFailoverSpiFormatted()

Gets a formatted instance of fully configured failover SPI implementations.

Specified by:
  `getFailoverSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid failover SPI implementations.

#### getLoadBalancingSpiFormatted

    public String getLoadBalancingSpiFormatted()

Gets a formatted instance of fully configured load balancing SPI implementations.

Specified by:
  `getLoadBalancingSpiFormatted` in interface `IgniteMXBean`
Returns:
  Grid load balancing SPI implementations.

#### getOsInformation

    public String getOsInformation()

Gets OS information.

Specified by:
  `getOsInformation` in interface `IgniteMXBean`
Returns:
  OS information.

#### getJdkInformation

    public String getJdkInformation()

Gets JDK information.

Specified by:
  `getJdkInformation` in interface `IgniteMXBean`
Returns:
  JDK information.

#### getOsUser

    public String getOsUser()

Gets OS user.

Specified by:
  `getOsUser` in interface `IgniteMXBean`
Returns:
  OS user name.

#### getVmName

    public String getVmName()

Gets VM name.

Specified by:
  `getVmName` in interface `IgniteMXBean`
Returns:
  VM name.

#### getInstanceName

    public String getInstanceName()

Gets optional kernal instance name. It can be `null`.

Specified by:
  `getInstanceName` in interface `IgniteMXBean`
Returns:
  Optional kernal instance name.

#### getExecutorServiceFormatted

    public String getExecutorServiceFormatted()

Gets a formatted instance of fully configured thread pool that is used in grid.

Specified by:
  `getExecutorServiceFormatted` in interface `IgniteMXBean`
Returns:
  Thread pool implementation that is used in grid.

#### getIgniteHome

    public String getIgniteHome()

Gets Ignite installation home folder.

Specified by:
  `getIgniteHome` in interface `IgniteMXBean`
Returns:
  Ignite installation home.

#### getGridLoggerFormatted

    public String getGridLoggerFormatted()

Gets a formatted instance of logger that is in grid.

Specified by:
  `getGridLoggerFormatted` in interface `IgniteMXBean`
Returns:
  Logger that is used in grid.

#### getMBeanServerFormatted

    public String getMBeanServerFormatted()

Gets a formatted instance of MBean server instance.

Specified by:
  `getMBeanServerFormatted` in interface `IgniteMXBean`
Returns:
  MBean server instance.

#### getLocalNodeId

    public UUID getLocalNodeId()

Unique identifier for this node within grid.

Specified by:
  `getLocalNodeId` in interface `IgniteMXBean`
Returns:
  Unique identifier for this node within grid.

#### getUserAttributesFormatted

    public Collection<String> getUserAttributesFormatted()

Gets a collection of formatted user-defined attributes added to this node.

Note that grid will add all System properties and environment properties to grid node attributes also. SPIs may also add node attributes that are used for SPI implementation.

Specified by:
  `getUserAttributesFormatted` in interface `IgniteMXBean`
Returns:
  User defined attributes for this node.

#### isPeerClassLoadingEnabled

    public boolean isPeerClassLoadingEnabled()

Returns `true` if peer class loading is enabled, `false` otherwise. Default value is `true`.

When peer class loading is enabled and task is not deployed on local node, local node will try to load classes from the node that initiated task execution. This way, a task can be physically deployed only on one node and then internally penetrate to all other nodes.

Specified by:
  `isPeerClassLoadingEnabled` in interface `IgniteMXBean`
Returns:
  `true` if peer class loading is enabled, `false` otherwise.

#### getLifecycleBeansFormatted

    public Collection<String> getLifecycleBeansFormatted()

Gets `toString()` representation of of lifecycle beans configured with Ignite.

Specified by:
  `getLifecycleBeansFormatted` in interface `IgniteMXBean`
Returns:
  `toString()` representation of all lifecycle beans configured with Ignite.

#### start

    public void start(IgniteConfiguration cfg,
             ExecutorService utilityCachePool,
             ExecutorService execSvc,
             ExecutorService sysExecSvc,
             ExecutorService p2pExecSvc,
             ExecutorService mgmtExecSvc,
             ExecutorService igfsExecSvc,
             ExecutorService restExecSvc,
             GridAbsClosure errHnd)
               throws IgniteCheckedException

Parameters:
  `cfg` - Grid configuration to use.
  `utilityCachePool` - Utility cache pool.
  `execSvc` -
  `sysExecSvc` -
  `p2pExecSvc` -
  `mgmtExecSvc` -
  `igfsExecSvc` -
  `errHnd` - Error handler to use for notification about startup problems. @throws IgniteCheckedException Thrown in case of any errors.
Throws:
  `IgniteCheckedException`

#### stop

    public void stop(boolean cancel)

Stops grid instance.

Parameters:
  `cancel` - Whether or not to cancel running jobs.

#### internalCache

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

USED ONLY FOR TESTING.

Type Parameters:
  `K` - Key type.
  `V` - Value type.
Returns:
  Internal cache instance.

#### internalCache

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

USED ONLY FOR TESTING.

Type Parameters:
  `K` - Key type.
  `V` - Value type.
Parameters:
  `name` - Cache name.
Returns:
  Internal cache instance.

#### context

    public GridKernalContext context()

It's intended for use by internal marshalling implementation only.

Returns:
  Kernal context.

#### isJmxRemoteEnabled

    public boolean isJmxRemoteEnabled()

Whether or not remote JMX management is enabled for this node. Remote JMX management is enabled when the following system property is set:

- `com.sun.management.jmxremote`

Specified by:
  `isJmxRemoteEnabled` in interface `IgniteEx`
Returns:
  `True` if remote JMX management is enabled - `false` otherwise.

#### isRestartEnabled

    public boolean isRestartEnabled()

Whether or not node restart is enabled. Node restart us supported when this node was started with `bin/ignite.{sh|bat}` script using `-r` argument. Node can be programmatically restarted using `Ignition.restart(boolean)`} method.

Specified by:
  `isRestartEnabled` in interface `IgniteEx`
Returns:
  `True` if restart mode is enabled, `false` otherwise.
See Also:
  `Ignition.restart(boolean)`

#### configuration

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

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

#### log

    public IgniteLogger log()

Gets grid's logger.

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

#### removeCheckpoint

    public boolean removeCheckpoint(String key)

This method allows manually remove the checkpoint with given `key`.

Specified by:
  `removeCheckpoint` in interface `IgniteMXBean`
Parameters:
  `key` - Checkpoint key.
Returns:
  `true` if specified checkpoint was indeed removed, `false` otherwise.

#### pingNode

    public boolean pingNode(String nodeId)

Pings node with given node ID to see whether it is alive.

Specified by:
  `pingNode` in interface `IgniteMXBean`
Parameters:
  `nodeId` - String presentation of node ID. See `UUID.fromString(String)` for details on string formatting.
Returns:
  Whether or not node is alive.

#### topology

    public Collection<ClusterNode> topology(long topVer)

Gets a topology by version. Returns `null` if topology history storage doesn't contain specified topology version (history currently keeps last `1000` snapshots).

Specified by:
  `topology` in interface `IgniteCluster`
Parameters:
  `topVer` - Topology version.
Returns:
  Collection of grid nodes which represented by specified topology version, if it is present in history storage, `null` otherwise.

#### topologyVersion

    public long topologyVersion()

Gets current topology version. In case of TCP discovery (see `TcpDiscoverySpi`) topology versions are sequential - they start from `'1'` and get incremented every time whenever a node joins or leaves. For other discovery SPIs topology versions may not be (and likely are not) sequential.

Specified by:
  `topologyVersion` in interface `IgniteCluster`
Returns:
  Current topology version.

#### undeployTaskFromGrid

    public void undeployTaskFromGrid(String taskName)
                              throws JMException

Makes the best attempt to undeploy a task from the whole grid. Note that this method returns immediately and does not wait until the task will actually be undeployed on every node.

Note that Ignite maintains internal versions for grid tasks in case of redeployment. This method will attempt to undeploy all versions on the grid task with given name.

Specified by:
  `undeployTaskFromGrid` in interface `IgniteMXBean`
Parameters:
  `taskName` - Name of the task to undeploy. If task class has `ComputeTaskName` annotation, then task was deployed under a name specified within annotation. Otherwise, full class name should be used as task's name.
Throws:
  `JMException` - Thrown if undeploy failed.

#### executeTask

    public String executeTask(String taskName,
                     String arg)
                       throws JMException

A shortcut method that executes given task assuming single `java.lang.String` argument and `java.lang.String` return type.

Specified by:
  `executeTask` in interface `IgniteMXBean`
Parameters:
  `taskName` - Name of the task to execute.
  `arg` - Single task execution argument (can be `null`).
Returns:
  Task return value (assumed of `java.lang.String` type).
Throws:
  `JMException` - Thrown in case when execution failed.

#### pingNodeByAddress

    public boolean pingNodeByAddress(String host)

Pings node with given host name to see if it is alive.

Specified by:
  `pingNodeByAddress` in interface `IgniteMXBean`
Parameters:
  `host` - Host name or IP address of the node to ping.
Returns:
  Whether or not node is alive.

#### localNode

    public ClusterNode localNode()

Gets local grid node.

Specified by:
  `localNode` in interface `IgniteCluster`
Returns:
  Local grid node.

#### nodeLocalMap

    public <K,V> ClusterNodeLocalMap<K,V> nodeLocalMap()

Gets node-local storage instance.

Node-local values are similar to thread locals in a way that these values are not distributed and kept only on local node (similar like thread local values are attached to the current thread only). Node-local values are used primarily by closures executed from the remote nodes to keep intermediate state on the local node between executions.

There's only one instance of node local storage per local node. Node local storage is based on `ConcurrentMap` and is safe for multi-threaded access.

Specified by:
  `nodeLocalMap` in interface `IgniteCluster`
Returns:
  Node local storage instance for the local node.

#### pingNode

    public boolean pingNode(UUID nodeId)

Pings a remote node.

Discovery SPIs usually have some latency in discovering failed nodes. Hence, communication to remote nodes may fail at times if an attempt was made to establish communication with a failed node. This method can be used to check if communication has failed due to node failure or due to some other reason.

Specified by:
  `pingNode` in interface `IgniteCluster`
Parameters:
  `nodeId` - ID of a node to ping.
Returns:
  `true` if node for a given ID is alive, `false` otherwise.
See Also:
  `DiscoverySpi`

#### startNodes

    public Collection<GridTuple3<String,Boolean,String>> startNodes(File file,
                                                           boolean restart,
                                                           int timeout,
                                                           int maxConn)

Starts one or more nodes on remote host(s).

This method takes INI file which defines all startup parameters. It can contain one or more sections, each for a host or for range of hosts (note that they must have different names) and a special '`defaults`' section with default values. They are applied to undefined parameters in host's sections.

Returned result is collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.

Supports asynchronous execution (see `IgniteAsyncSupport`).

Specified by:
  `startNodes` in interface `IgniteCluster`
Parameters:
  `file` - Configuration file.
  `restart` - Whether to stop existing nodes. If `true`, all existing nodes on the host will be stopped before starting new ones. If `false`, nodes will be started only if there are less nodes on the host than expected.
  `timeout` - Connection timeout.
  `maxConn` - Number of parallel SSH connections to one host.
Returns:
  Collection of tuples, each containing host name, result (success of failure) and error message (if any).

#### withAsync

    public IgniteCluster withAsync()

Gets component with asynchronous mode enabled.

Specified by:
  `withAsync` in interface `IgniteCluster`
Specified by:
  `withAsync` in interface `IgniteAsyncSupport`
Returns:
  Component with asynchronous mode enabled.

#### isAsync

    public boolean isAsync()

Specified by:
  `isAsync` in interface `IgniteAsyncSupport`
Returns:
  `True` if asynchronous mode is enabled.

#### future

    public <R> IgniteFuture<R> future()

Gets and resets future for previous asynchronous operation.

Specified by:
  `future` in interface `IgniteAsyncSupport`
Returns:
  Future for previous asynchronous operation.

#### startNodes

    public Collection<GridTuple3<String,Boolean,String>> startNodes(Collection<Map<String,Object>> hosts,
                                                           @Nullable
                                                           Map<String,Object> dflts,
                                                           boolean restart,
                                                           int timeout,
                                                           int maxConn)

Starts one or more nodes on remote host(s).

Each map in `hosts` collection defines startup parameters for one host or for a range of hosts. The following parameters are supported:

Name | Type | Description
--- | --- | ---
host | String | Hostname (required). Can define several hosts if their IPs are sequential. E.g., `10.0.0.1~5` defines range of five IP addresses. Other parameters are applied to all hosts equally.
port | Integer | Port number (default is `22`).
uname | String | Username (if not defined, current local username will be used).
passwd | String | Password (if not defined, private key file must be defined).
key | File | Private key file (if not defined, password must be defined).
nodes | Integer | Expected number of nodes on the host. If some nodes are started already, then only remaining nodes will be started. If current count of nodes is equal to this number, and `restart` flag is `false`, then nothing will happen.
igniteHome | String | Path to Ignite installation folder. If not defined, IGNITE_HOME environment variable must be set on remote hosts.
cfg | String | Path to configuration file (relative to `igniteHome`).
script | String | Custom startup script file name and path (relative to `igniteHome`). You can also specify a space-separated list of parameters in the same string (for example: `"bin/my-custom-script.sh -v"`).

`dflts` map defines default values. They are applied to undefined parameters in `hosts` collection.

Returned result is collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.

Supports asynchronous execution (see `IgniteAsyncSupport`).

Specified by:
  `startNodes` in interface `IgniteCluster`
Parameters:
  `hosts` - Startup parameters.
  `dflts` - Default values.
  `restart` - Whether to stop existing nodes. If `true`, all existing nodes on the host will be stopped before starting new ones. If `false`, nodes will be started only if there are less nodes on the host than expected.
  `timeout` - Connection timeout in milliseconds.
  `maxConn` - Number of parallel SSH connections to one host.
Returns:
  Collection of tuples, each containing host name, result (success of failure) and error message (if any).

#### stopNodes

    public void stopNodes()

Stops nodes satisfying optional set of predicates.

NOTE: `System.exit(Ignition.KILL_EXIT_CODE)` will be executed on each stopping node. If you have other applications running in the same JVM along with Ignition, those applications will be stopped as well.

Specified by:
  `stopNodes` in interface `IgniteCluster`

#### stopNodes

    public void stopNodes(Collection<UUID> ids)

Stops nodes defined by provided IDs.

NOTE: `System.exit(Ignition.KILL_EXIT_CODE)` will be executed on each stopping node. If you have other applications running in the same JVM along with Ignition, those applications will be stopped as well.

Specified by:
  `stopNodes` in interface `IgniteCluster`
Parameters:
  `ids` - IDs defining nodes to stop.

#### restartNodes

    public void restartNodes()

Restarts nodes satisfying optional set of predicates.

NOTE: this command only works for grid nodes started with Ignition `ignite.sh` or `ignite.bat` scripts.

Specified by:
  `restartNodes` in interface `IgniteCluster`

#### restartNodes

    public void restartNodes(Collection<UUID> ids)

Restarts nodes defined by provided IDs.

NOTE: this command only works for grid nodes started with Ignition `ignite.sh` or `ignite.bat` scripts.

Specified by:
  `restartNodes` in interface `IgniteCluster`
Parameters:
  `ids` - IDs defining nodes to restart.

#### eventUserRecordable

    public boolean eventUserRecordable(int type)

Checks if the event type is user-recordable.

Specified by:
  `eventUserRecordable` in interface `IgniteEx`
Parameters:
  `type` - Event type to check.
Returns:
  `true` if passed event should be recorded, `false` - otherwise.

#### allEventsUserRecordable

    public boolean allEventsUserRecordable(int[] types)

Checks whether all provided events are user-recordable.

Note that this method supports only predefined Ignite events.

Specified by:
  `allEventsUserRecordable` in interface `IgniteEx`
Parameters:
  `types` - Event types.
Returns:
  Whether all events are recordable.

#### transactions

    public IgniteTransactions transactions()

Gets grid transactions facade.

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

#### cache

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

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

#### jcache

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

Specified by:
  `jcache` in interface `Ignite`
Parameters:
  `name` - Cache name.
Returns:
  Instance of the cache for the specified name.

#### caches

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

Returns:
  Public caches.

#### utilityCache

    public <K extends GridCacheUtilityKey,V> GridCacheProjectionEx<K,V> utilityCache(Class<K> keyCls,
                                                                            Class<V> valCls)

Gets utility cache.

Specified by:
  `utilityCache` in interface `IgniteEx`
Parameters:
  `keyCls` - Key class.
  `valCls` - Value class.
Returns:
  Utility cache.

#### cachex

    public <K,V> GridCache<K,V> cachex(@Nullable
                              String name)

Gets the cache instance for the given name if one is configured or `null` otherwise returning even non-public caches.

Specified by:
  `cachex` in interface `IgniteEx`
Type Parameters:
  `K` - Key type.
  `V` - Value type.
Parameters:
  `name` - Cache name.
Returns:
  Cache instance for given name or `null` if one does not exist.

#### cachex

    public <K,V> GridCache<K,V> cachex()

Gets default cache instance if one is configured or `null` otherwise returning even non-public caches. The `CacheProjection.name()` method on default instance returns `null`.

Specified by:
  `cachex` in interface `IgniteEx`
Type Parameters:
  `K` - Key type.
  `V` - Value type.
Returns:
  Default cache instance.

#### cachesx

    public Collection<GridCache<?,?>> cachesx(IgnitePredicate<? super GridCache<?,?>>[] p)

Gets configured cache instance that satisfy all provided predicates including non-public caches. If no predicates provided - all configured caches will be returned.

Specified by:
  `cachesx` in interface `IgniteEx`
Parameters:
  `p` - Predicates. If none provided - all configured caches will be returned.
Returns:
  Configured cache instances that satisfy all provided predicates.

#### dataLoader

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

Specified by:
  `dataLoader` in interface `Ignite`
Parameters:
  `cacheName` - Cache name (`null` for default cache).
Returns:
  Data loader.

#### fileSystem

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

Specified by:
  `fileSystem` in interface `Ignite`
Parameters:
  `name` - IGFS name.
Returns:
  IGFS instance.

#### igfsx

    @Nullable
    public IgniteFs igfsx(@Nullable
                          String name)

Get IGFS instance returning null if it doesn't exist.

Specified by:
  `igfsx` in interface `IgniteEx`
Parameters:
  `name` - IGFS name.
Returns:
  IGFS.

#### fileSystems

    public Collection<IgniteFs> fileSystems()

Gets all instances of the grid file systems.

Specified by:
  `fileSystems` in interface `Ignite`
Returns:
  Collection of grid file systems instances.

#### hadoop

    public GridHadoop hadoop()

Get Hadoop facade.

Specified by:
  `hadoop` in interface `IgniteEx`
Returns:
  Hadoop.

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

#### mapKeysToNodes

    public <K> Map<ClusterNode,Collection<K>> mapKeysToNodes(String cacheName,
                                                    @Nullable
                                                    Collection<? extends K> keys)

This method provides ability to detect which cache keys are mapped to which nodes on cache instance with given name. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

- For local caches it returns only local node mapped to all keys.
- For fully replicated caches, `CacheAffinityFunction` is used to determine which keys are mapped to which groups of nodes.
- For partitioned caches, the returned map represents node-to-key affinity.

Specified by:
  `mapKeysToNodes` in interface `IgniteCluster`
Parameters:
  `cacheName` - Cache name, if `null`, then default cache instance is used.
  `keys` - Cache keys to map to nodes.
Returns:
  Map of nodes to cache keys or empty map if there are no alive nodes for this cache.

#### mapKeyToNode

    @Nullable
    public <K> ClusterNode mapKeyToNode(String cacheName,
                                        K key)

This method provides ability to detect which cache keys are mapped to which nodes on cache instance with given name. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

- For local caches it returns only local node ID.
- For fully replicated caches first node ID returned by `CacheAffinityFunction` is returned.
- For partitioned caches, the returned node ID is the primary node for the key.

Specified by:
  `mapKeyToNode` in interface `IgniteCluster`
Parameters:
  `cacheName` - Cache name, if `null`, then default cache instance is used.
  `key` - Cache key to map to a node.
Returns:
  Primary node for the key or `null` if cache with given name is not present in the grid.

#### resetMetrics

    public void resetMetrics()

Resets local I/O, job, and task execution metrics.

Specified by:
  `resetMetrics` in interface `IgniteCluster`

#### streamer

    public IgniteStreamer streamer(@Nullable
                          String name)

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

Specified by:
  `streamer` in interface `Ignite`
Parameters:
  `name` - Streamer name.
Returns:
  Streamer for given name.

#### streamers

    public Collection<IgniteStreamer> streamers()

Gets all instances of streamers.

Specified by:
  `streamers` in interface `Ignite`
Returns:
  Collection of all streamer instances.

#### forLocal

    public ClusterGroup forLocal()

Gets monadic projection consisting from the local node.

Specified by:
  `forLocal` in interface `IgniteCluster`
Returns:
  Monadic projection consisting from the local node.

#### version

    public IgniteProductVersion version()

Gets Ignite version.

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

#### latestVersion

    public String latestVersion()

Get latest version in string form.

Specified by:
  `latestVersion` in interface `IgniteEx`
Returns:
  Latest version.

#### scheduler

    public IgniteScheduler scheduler()

Gets an instance of cron-based scheduler.

Specified by:
  `scheduler` in interface `Ignite`
Returns:
  Instance of scheduler.

#### compatibleVersions

    public Collection<String> compatibleVersions()

Gets list of compatible versions.

Specified by:
  `compatibleVersions` in interface `IgniteEx`
Returns:
  Compatible versions.

#### close

    public 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`
Specified by:
  `close` in interface `Ignite`
Throws:
  `IgniteException` - If failed to stop grid.

#### affinity

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

#### atomicSequence

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

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.

#### atomicLong

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

#### atomicReference

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

Specified by:
  `atomicReference` in interface `Ignite`
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.

#### atomicStamped

    @Nullable
    public <T,S> 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`
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.

#### countDownLatch

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

#### queue

    @Nullable
    public <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`. 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`
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> 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`
Parameters:
  `name` - Set name.
  `cfg` - Set configuration if new set should be created.
Returns:
  Set with given properties.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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