org.apache.ignite.internal

## Class GridKernalContextImpl

- java.lang.Object
- - org.apache.ignite.internal.GridKernalContextImpl

All Implemented Interfaces:
  Externalizable, Serializable, Iterable<GridComponent>, GridKernalContext

    @GridToStringExclude
    public class GridKernalContextImpl
    extends Object
    implements GridKernalContext, Externalizable

Implementation of kernal context.

See Also:
  Serialized Form

### Field Summary

Fields
`protected ExecutorService` `execSvc`
`protected ExecutorService` `restExecSvc`
`protected ExecutorService` `sysExecSvc`

### Constructor Summary

Constructors
`` `GridKernalContextImpl()` No-arg constructor is required by externalization.

`protected`

`GridKernalContextImpl(GridLoggerProxy log, IgniteEx grid, IgniteConfiguration cfg, GridKernalGateway gw, ExecutorService utilityCachePool, ExecutorService marshCachePool, ExecutorService execSvc, ExecutorService sysExecSvc, ExecutorService p2pExecSvc, ExecutorService mgmtExecSvc, ExecutorService igfsExecSvc, ExecutorService restExecSvc, List<PluginProvider> plugins)`
Creates new kernal context.

### Method Summary

Methods
`void` `add(GridComponent comp)`
`void` `add(GridComponent comp, boolean addToList)`
`void` `addHelper(Object helper)`
`Object` `addNodeAttribute(String key, Object val)` Add attribute to node attributes.
`GridAffinityProcessor` `affinity()` Gets cache data affinity processor.
`GridCacheProcessor` `cache()` Gets caches processor.
`IgniteCacheObjectProcessor` `cacheObjects()` Gets cache object processor.
`GridCheckpointManager` `checkpoint()` Gets checkpoint manager.
`boolean` `clientDisconnected()`
`boolean` `clientNode()`
`GridClockSyncProcessor` `clockSync()` Gets time processor.
`GridClosureProcessor` `closure()` Gets closure processor.
`ClusterProcessor` `cluster()` Gets Cluster processor.
`GridCollisionManager` `collision()` Gets collision manager.
`List<GridComponent>` `components()` Gets list of all grid components in the order they were added.
`IgniteConfiguration` `config()` Gets grid configuration.
`GridContinuousProcessor` `continuous()` Gets event continuous processor.
`<T> T` `createComponent(Class<T> cls)` Creates optional component.
`<K,V> DataStreamProcessor<K,V>` `dataStream()` Gets data streamer processor.
`DataStructuresProcessor` `dataStructures()` Gets data structures processor.
`GridDeploymentManager` `deploy()` Gets deployment manager.
`GridDiscoveryManager` `discovery()` Gets discovery manager.
`GridEventStorageManager` `event()` Gets event storage manager.
`IgniteExceptionRegistry` `exceptionRegistry()` Gets exception registry.
`GridFailoverManager` `failover()` Gets failover manager.
`GridKernalGateway` `gateway()` Gets kernal gateway.
`ExecutorService` `getExecutorService()`
`ExecutorService` `getIgfsExecutorService()` Executor service that is in charge of processing outgoing IGFS messages.
`ExecutorService` `getManagementExecutorService()` Executor service that is in charge of processing internal and Visor `GridJobs`.
`ExecutorService` `getPeerClassLoadingExecutorService()`
`ExecutorService` `getRestExecutorService()` Should return an instance of fully configured thread pool to be used for processing of client messages (REST requests).
`ExecutorService` `getSystemExecutorService()` Executor service that is in charge of processing internal system messages.
`IgniteEx` `grid()` Gets grid instance managed by kernal.
`String` `gridName()` Gets grid name.
`HadoopProcessorAdapter` `hadoop()` Gets Hadoop processor.
`boolean` `hasNodeAttribute(String key)` Check if node has specified attribute.
`IgfsProcessorAdapter` `igfs()` Gets file system processor.
`IgfsHelper` `igfsHelper()` Gets IGFS utils processor.
`GridIndexingManager` `indexing()` Gets indexing manager.
`GridIoManager` `io()` Gets communication manager.
`boolean` `isDaemon()` Checks whether this node is daemon.
`boolean` `isStopping()`
`Iterator<GridComponent>` `iterator()`
`GridJobProcessor` `job()` Gets job processor.
`GridJobMetricsProcessor` `jobMetric()` Gets job metric processor.
`GridLoadBalancerManager` `loadBalancing()` Gets load balancing manager.
`UUID` `localNodeId()` Gets local node ID.
`IgniteLogger` `log(Class<?> cls)` Gets logger for given class.
`IgniteLogger` `log(String ctgr)` Gets logger for given category.
`void` `markSegmented()` Sets segmented flag to `true` when node is stopped due to segmentation issues.
`ExecutorService` `marshallerCachePool()` Gets marshaller cache pool.
`MarshallerContextImpl` `marshallerContext()` Gets marshaller context.
`Object` `nodeAttribute(String key)` Get node attribute by name.
`Map<String,Object>` `nodeAttributes()`
`GridOffHeapProcessor` `offheap()` Gets offheap processor.
`GridPerformanceSuggestions` `performance()`
`PlatformProcessor` `platform()`
`PluginProvider` `pluginProvider(String name)`
`IgnitePluginProcessor` `plugins()`
`GridPortProcessor` `ports()` Gets port processor.
`void` `printMemoryStats()` Print grid kernal memory stats (sizes of internal structures, etc.).
`GridQueryProcessor` `query()` Gets query processor.
`void` `readExternal(ObjectInput in)`
`protected Object` `readResolve()` Reconstructs object on unmarshalling.
`GridResourceProcessor` `resource()` Gets resource processor.
`GridRestProcessor` `rest()` Gets REST processor.
`IgniteScheduleProcessorAdapter` `schedule()` Gets schedule processor.
`GridSecurityProcessor` `security()` Gets authentication processor.
`GridSegmentationProcessor` `segmentation()` Gets segmentation processor.
`boolean` `segmented()` Gets segmented flag.
`GridServiceProcessor` `service()` Gets service processor.
`GridTaskSessionProcessor` `session()` Gets task session processor.
`GridSwapSpaceManager` `swap()` Gets swap space manager.
`GridTaskProcessor` `task()` Gets task processor.
`GridTimeoutProcessor` `timeout()` Gets timeout processor.
`GridClockSource` `timeSource()` Gets grid time source.
`void` `timeSource(GridClockSource clockSrc)` Sets time source.
`String` `toString()`
`String` `userVersion(ClassLoader ldr)` Gets user version for given class loader by checking `META-INF/ignite.xml` file for `userVersion` attribute.
`ExecutorService` `utilityCachePool()` Gets utility cache pool.
`void` `writeExternal(ObjectOutput out)`

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

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

### Field Detail

#### execSvc

    @GridToStringExclude
    protected ExecutorService execSvc

#### sysExecSvc

    @GridToStringExclude
    protected ExecutorService sysExecSvc

#### restExecSvc

    @GridToStringExclude
    protected ExecutorService restExecSvc

### Constructor Detail

#### GridKernalContextImpl

    public GridKernalContextImpl()

No-arg constructor is required by externalization.

#### GridKernalContextImpl

    protected GridKernalContextImpl(GridLoggerProxy log,
                         IgniteEx grid,
                         IgniteConfiguration cfg,
                         GridKernalGateway gw,
                         ExecutorService utilityCachePool,
                         ExecutorService marshCachePool,
                         ExecutorService execSvc,
                         ExecutorService sysExecSvc,
                         ExecutorService p2pExecSvc,
                         ExecutorService mgmtExecSvc,
                         ExecutorService igfsExecSvc,
                         ExecutorService restExecSvc,
                         List<PluginProvider> plugins)
                             throws IgniteCheckedException

Creates new kernal context.

Parameters:
  `log` - Logger.
  `grid` - Grid instance managed by kernal.
  `cfg` - Grid configuration.
  `gw` - Kernal gateway.
  `utilityCachePool` - Utility cache pool.
  `marshCachePool` - Marshaller cache pool.
  `execSvc` - Public executor service.
  `sysExecSvc` - System executor service.
  `p2pExecSvc` - P2P executor service.
  `mgmtExecSvc` - Management executor service.
  `igfsExecSvc` - IGFS executor service.
  `restExecSvc` - REST executor service.
  `plugins` - Plugin providers.
Throws:
  `IgniteCheckedException` - In case of error.

### Method Detail

#### iterator

    public Iterator<GridComponent> iterator()

Specified by:
  `iterator` in interface `Iterable<GridComponent>`

#### components

    public List<GridComponent> components()

Gets list of all grid components in the order they were added.

Specified by:
  `components` in interface `GridKernalContext`
Returns:
  List of all grid components in the order they were added.

#### add

    public void add(GridComponent comp)

Parameters:
  `comp` - Manager to add.

#### add

    public void add(GridComponent comp,
           boolean addToList)

Parameters:
  `comp` - Manager to add.
  `addToList` - If `true` component is added to components list.

#### addHelper

    public void addHelper(Object helper)

Parameters:
  `helper` - Helper to add.

#### isStopping

    public boolean isStopping()

Specified by:
  `isStopping` in interface `GridKernalContext`
Returns:
  `True` if grid is in the process of stopping.

#### localNodeId

    public UUID localNodeId()

Gets local node ID.

Specified by:
  `localNodeId` in interface `GridKernalContext`
Returns:
  Local node ID.

#### gridName

    public String gridName()

Gets grid name.

Specified by:
  `gridName` in interface `GridKernalContext`
Returns:
  Grid name.

#### gateway

    public GridKernalGateway gateway()

Gets kernal gateway.

Specified by:
  `gateway` in interface `GridKernalContext`
Returns:
  Kernal gateway.

#### grid

    public IgniteEx grid()

Gets grid instance managed by kernal.

Specified by:
  `grid` in interface `GridKernalContext`
Returns:
  Grid instance.

#### config

    public IgniteConfiguration config()

Gets grid configuration.

Specified by:
  `config` in interface `GridKernalContext`
Returns:
  Grid configuration.

#### task

    public GridTaskProcessor task()

Gets task processor.

Specified by:
  `task` in interface `GridKernalContext`
Returns:
  Task processor.

#### job

    public GridJobProcessor job()

Gets job processor.

Specified by:
  `job` in interface `GridKernalContext`
Returns:
  Job processor

#### timeout

    public GridTimeoutProcessor timeout()

Gets timeout processor.

Specified by:
  `timeout` in interface `GridKernalContext`
Returns:
  Timeout processor.

#### clockSync

    public GridClockSyncProcessor clockSync()

Gets time processor.

Specified by:
  `clockSync` in interface `GridKernalContext`
Returns:
  Time processor.

#### resource

    public GridResourceProcessor resource()

Gets resource processor.

Specified by:
  `resource` in interface `GridKernalContext`
Returns:
  Resource processor.

#### jobMetric

    public GridJobMetricsProcessor jobMetric()

Gets job metric processor.

Specified by:
  `jobMetric` in interface `GridKernalContext`
Returns:
  Metrics processor.

#### cache

    public GridCacheProcessor cache()

Gets caches processor.

Specified by:
  `cache` in interface `GridKernalContext`
Returns:
  Cache processor.

#### session

    public GridTaskSessionProcessor session()

Gets task session processor.

Specified by:
  `session` in interface `GridKernalContext`
Returns:
  Session processor.

#### closure

    public GridClosureProcessor closure()

Gets closure processor.

Specified by:
  `closure` in interface `GridKernalContext`
Returns:
  Closure processor.

#### service

    public GridServiceProcessor service()

Gets service processor.

Specified by:
  `service` in interface `GridKernalContext`
Returns:
  Service processor.

#### ports

    public GridPortProcessor ports()

Gets port processor.

Specified by:
  `ports` in interface `GridKernalContext`
Returns:
  Port processor.

#### offheap

    public GridOffHeapProcessor offheap()

Gets offheap processor.

Specified by:
  `offheap` in interface `GridKernalContext`
Returns:
  Off-heap processor.

#### schedule

    public IgniteScheduleProcessorAdapter schedule()

Gets schedule processor.

Specified by:
  `schedule` in interface `GridKernalContext`
Returns:
  Schedule processor.

#### deploy

    public GridDeploymentManager deploy()

Gets deployment manager.

Specified by:
  `deploy` in interface `GridKernalContext`
Returns:
  Deployment manager.

#### io

    public GridIoManager io()

Gets communication manager.

Specified by:
  `io` in interface `GridKernalContext`
Returns:
  Communication manager.

#### discovery

    public GridDiscoveryManager discovery()

Gets discovery manager.

Specified by:
  `discovery` in interface `GridKernalContext`
Returns:
  Discovery manager.

#### checkpoint

    public GridCheckpointManager checkpoint()

Gets checkpoint manager.

Specified by:
  `checkpoint` in interface `GridKernalContext`
Returns:
  Checkpoint manager.

#### event

    public GridEventStorageManager event()

Gets event storage manager.

Specified by:
  `event` in interface `GridKernalContext`
Returns:
  Event storage manager.

#### failover

    public GridFailoverManager failover()

Gets failover manager.

Specified by:
  `failover` in interface `GridKernalContext`
Returns:
  Failover manager.

#### collision

    public GridCollisionManager collision()

Gets collision manager.

Specified by:
  `collision` in interface `GridKernalContext`
Returns:
  Collision manager.

#### security

    public GridSecurityProcessor security()

Gets authentication processor.

Specified by:
  `security` in interface `GridKernalContext`
Returns:
  Authentication processor.

#### loadBalancing

    public GridLoadBalancerManager loadBalancing()

Gets load balancing manager.

Specified by:
  `loadBalancing` in interface `GridKernalContext`
Returns:
  Load balancing manager.

#### swap

    public GridSwapSpaceManager swap()

Gets swap space manager.

Specified by:
  `swap` in interface `GridKernalContext`
Returns:
  Swap space manager.

#### indexing

    public GridIndexingManager indexing()

Gets indexing manager.

Specified by:
  `indexing` in interface `GridKernalContext`
Returns:
  Indexing manager.

#### affinity

    public GridAffinityProcessor affinity()

Gets cache data affinity processor.

Specified by:
  `affinity` in interface `GridKernalContext`
Returns:
  Cache data affinity processor.

#### rest

    public GridRestProcessor rest()

Gets REST processor.

Specified by:
  `rest` in interface `GridKernalContext`
Returns:
  REST processor.

#### segmentation

    public GridSegmentationProcessor segmentation()

Gets segmentation processor.

Specified by:
  `segmentation` in interface `GridKernalContext`
Returns:
  Segmentation processor.

#### dataStream

    public <K,V> DataStreamProcessor<K,V> dataStream()

Gets data streamer processor.

Specified by:
  `dataStream` in interface `GridKernalContext`
Returns:
  Data streamer processor.

#### igfs

    public IgfsProcessorAdapter igfs()

Gets file system processor.

Specified by:
  `igfs` in interface `GridKernalContext`
Returns:
  File system processor.

#### igfsHelper

    public IgfsHelper igfsHelper()

Gets IGFS utils processor.

Specified by:
  `igfsHelper` in interface `GridKernalContext`
Returns:
  IGFS utils processor.

#### continuous

    public GridContinuousProcessor continuous()

Gets event continuous processor.

Specified by:
  `continuous` in interface `GridKernalContext`
Returns:
  Event continuous processor.

#### hadoop

    public HadoopProcessorAdapter hadoop()

Gets Hadoop processor.

Specified by:
  `hadoop` in interface `GridKernalContext`
Returns:
  Hadoop processor.

#### utilityCachePool

    public ExecutorService utilityCachePool()

Gets utility cache pool.

Specified by:
  `utilityCachePool` in interface `GridKernalContext`
Returns:
  Utility cache pool.

#### marshallerCachePool

    public ExecutorService marshallerCachePool()

Gets marshaller cache pool.

Specified by:
  `marshallerCachePool` in interface `GridKernalContext`
Returns:
  Marshaller cache pool.

#### cacheObjects

    public IgniteCacheObjectProcessor cacheObjects()

Gets cache object processor.

Specified by:
  `cacheObjects` in interface `GridKernalContext`
Returns:
  Cache object processor.

#### query

    public GridQueryProcessor query()

Gets query processor.

Specified by:
  `query` in interface `GridKernalContext`
Returns:
  Query processor.

#### dataStructures

    public DataStructuresProcessor dataStructures()

Gets data structures processor.

Specified by:
  `dataStructures` in interface `GridKernalContext`
Returns:
  Data structures processor.

#### log

    public IgniteLogger log(String ctgr)

Gets logger for given category.

Specified by:
  `log` in interface `GridKernalContext`
Parameters:
  `ctgr` - Category.
Returns:
  Logger.

#### log

    public IgniteLogger log(Class<?> cls)

Gets logger for given class.

Specified by:
  `log` in interface `GridKernalContext`
Parameters:
  `cls` - Class to get logger for.
Returns:
  Logger.

#### markSegmented

    public void markSegmented()

Sets segmented flag to `true` when node is stopped due to segmentation issues.

Specified by:
  `markSegmented` in interface `GridKernalContext`

#### segmented

    public boolean segmented()

Gets segmented flag.

Specified by:
  `segmented` in interface `GridKernalContext`
Returns:
  `True` if network is currently segmented, `false` otherwise.

#### timeSource

    public GridClockSource timeSource()

Gets grid time source.

Specified by:
  `timeSource` in interface `GridKernalContext`
Returns:
  Time source.

#### timeSource

    public void timeSource(GridClockSource clockSrc)

Sets time source. For test purposes only.

Parameters:
  `clockSrc` - Time source.

#### performance

    public GridPerformanceSuggestions performance()

Specified by:
  `performance` in interface `GridKernalContext`
Returns:
  Performance suggestions object.

#### printMemoryStats

    public void printMemoryStats()

Print grid kernal memory stats (sizes of internal structures, etc.). NOTE: This method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridKernalContext`

#### isDaemon

    public boolean isDaemon()

Checks whether this node is daemon.

Specified by:
  `isDaemon` in interface `GridKernalContext`
Returns:
  `True` if this node is daemon, `false` otherwise.

#### userVersion

    public String userVersion(ClassLoader ldr)

Gets user version for given class loader by checking `META-INF/ignite.xml` file for `userVersion` attribute. If `ignite.xml` file is not found, or user version is not specified there, then default version (empty string) is returned.

Specified by:
  `userVersion` in interface `GridKernalContext`
Parameters:
  `ldr` - Class loader.
Returns:
  User version for given class loader or empty string if no version was explicitly specified.

#### pluginProvider

    public PluginProvider pluginProvider(String name)
                                  throws PluginNotFoundException

Specified by:
  `pluginProvider` in interface `GridKernalContext`
Parameters:
  `name` - Plugin name.
Returns:
  Plugin provider instance.
Throws:
  `PluginNotFoundException` - If plugin provider for the given name was not found.

#### createComponent

    @Nullable
    public <T> T createComponent(Class<T> cls)

Creates optional component.

Specified by:
  `createComponent` in interface `GridKernalContext`
Parameters:
  `cls` - Component class.
Returns:
  Created component.

#### plugins

    public IgnitePluginProcessor plugins()

Specified by:
  `plugins` in interface `GridKernalContext`
Returns:
  Plugin manager.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

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

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

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

#### readResolve

    protected Object readResolve()
                          throws ObjectStreamException

Reconstructs object on unmarshalling.

Returns:
  Reconstructed object.
Throws:
  `ObjectStreamException` - Thrown in case of unmarshalling error.

#### getExecutorService

    public ExecutorService getExecutorService()

Specified by:
  `getExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used in grid to process job execution requests and user messages sent to the node.

#### getSystemExecutorService

    public ExecutorService getSystemExecutorService()

Executor service that is in charge of processing internal system messages.

Specified by:
  `getSystemExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used in grid for internal system messages.

#### getManagementExecutorService

    public ExecutorService getManagementExecutorService()

Executor service that is in charge of processing internal and Visor `GridJobs`.

Specified by:
  `getManagementExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used in grid for internal and Visor jobs processing.

#### getPeerClassLoadingExecutorService

    public ExecutorService getPeerClassLoadingExecutorService()

Specified by:
  `getPeerClassLoadingExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used for peer class loading requests handling.

#### getIgfsExecutorService

    public ExecutorService getIgfsExecutorService()

Executor service that is in charge of processing outgoing IGFS messages.

Specified by:
  `getIgfsExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used for IGFS outgoing message sending.

#### getRestExecutorService

    public ExecutorService getRestExecutorService()

Should return an instance of fully configured thread pool to be used for processing of client messages (REST requests).

Specified by:
  `getRestExecutorService` in interface `GridKernalContext`
Returns:
  Thread pool implementation to be used for processing of client messages.

#### exceptionRegistry

    public IgniteExceptionRegistry exceptionRegistry()

Gets exception registry.

Specified by:
  `exceptionRegistry` in interface `GridKernalContext`
Returns:
  Exception registry.

#### nodeAttribute

    public Object nodeAttribute(String key)

Get node attribute by name.

Specified by:
  `nodeAttribute` in interface `GridKernalContext`
Parameters:
  `key` - Attribute name.
Returns:
  Attribute value.

#### hasNodeAttribute

    public boolean hasNodeAttribute(String key)

Check if node has specified attribute.

Specified by:
  `hasNodeAttribute` in interface `GridKernalContext`
Parameters:
  `key` - Attribute name.
Returns:
  `true` If node has attribute with specified name.

#### addNodeAttribute

    public Object addNodeAttribute(String key,
                          Object val)

Add attribute to node attributes.

Specified by:
  `addNodeAttribute` in interface `GridKernalContext`
Parameters:
  `key` - Attribute name.
  `val` - Attribute value.
Returns:
  Previous attribute value associated with attribute name.

#### nodeAttributes

    public Map<String,Object> nodeAttributes()

Specified by:
  `nodeAttributes` in interface `GridKernalContext`
Returns:
  Node attributes.

#### cluster

    public ClusterProcessor cluster()

Gets Cluster processor.

Specified by:
  `cluster` in interface `GridKernalContext`
Returns:
  Cluster processor.

#### marshallerContext

    public MarshallerContextImpl marshallerContext()

Gets marshaller context.

Specified by:
  `marshallerContext` in interface `GridKernalContext`
Returns:
  Marshaller context.

#### clientNode

    public boolean clientNode()

Specified by:
  `clientNode` in interface `GridKernalContext`
Returns:
  `True` if local node is client node (has flag `IgniteConfiguration.isClientMode()` set).

#### clientDisconnected

    public boolean clientDisconnected()

Specified by:
  `clientDisconnected` in interface `GridKernalContext`
Returns:
  `True` if local node in disconnected state.

#### platform

    public PlatformProcessor platform()

Specified by:
  `platform` in interface `GridKernalContext`
Returns:
  Platform processor.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0-b1
Release Date | : December 1 2015