org.apache.ignite.internal.processors

## Class GridProcessorAdapter

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter

All Implemented Interfaces:
  GridComponent, GridProcessor

Direct Known Subclasses:
  ClusterProcessor, DataStreamProcessor, DataStructuresProcessor, GridAffinityProcessor, GridCacheProcessor, GridClosureProcessor, GridClusterStateProcessor, GridContinuousProcessor, GridJobMetricsProcessor, GridJobProcessor, GridMarshallerMappingProcessor, GridOffHeapProcessor, GridOsSecurityProcessor, GridOsSegmentationProcessor, GridPortProcessor, GridQueryProcessor, GridResourceProcessor, GridRestProcessor, GridServiceProcessor, GridTaskProcessor, GridTaskSessionProcessor, GridTimeoutProcessor, HadoopProcessorAdapter, IgfsProcessorAdapter, IgniteCacheObjectProcessorImpl, IgnitePluginProcessor, IgniteScheduleProcessorAdapter, OsDiscoveryNodeValidationProcessor, PlatformNoopProcessor, PlatformPluginProcessor, PlatformProcessorImpl, PoolProcessor, SqlListenerProcessor

    public abstract class GridProcessorAdapter
    extends Object
    implements GridProcessor

Advanced parent adapter for all processor.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`protected GridKernalContext` `ctx` Kernal context.
`protected IgniteLogger` `diagnosticLog` Diagnostic logger.
`protected IgniteLogger` `log` Grid logger.

### Constructor Summary

Constructors
`protected` `GridProcessorAdapter(GridKernalContext ctx)`

### Method Summary

Methods
`protected void` `assertParameter(boolean cond, String condDesc)` Throws exception with uniform error message if given parameter's assertion condition is `false`.
`void` `collectGridNodeData(DiscoveryDataBag dataBag)` Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.
`void` `collectJoiningNodeData(DiscoveryDataBag dataBag)` Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.
`GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`void` `onDisconnected(IgniteFuture<?> reconnectFut)` Client disconnected callback.
`void` `onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)` Receives discovery data object from remote nodes (called on new node during discovery process).
`void` `onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)` Method is called on nodes that are already in grid (not on joining node).
`void` `onKernalStart(boolean active)` Callback that notifies that kernal has successfully started, including all managers and processors.
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.
`String` `toString()`
`IgniteNodeValidationResult` `validateNode(ClusterNode node)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

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

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

### Field Detail

#### ctx

    @GridToStringExclude
    protected final GridKernalContext ctx

Kernal context.

#### log

    @GridToStringExclude
    protected final IgniteLogger log

Grid logger.

#### diagnosticLog

    @GridToStringExclude
    protected final IgniteLogger diagnosticLog

Diagnostic logger.

### Constructor Detail

#### GridProcessorAdapter

    protected GridProcessorAdapter(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### onKernalStart

    public void onKernalStart(boolean active)
                       throws IgniteCheckedException

Callback that notifies that kernal has successfully started, including all managers and processors.

Specified by:
  `onKernalStart` in interface `GridComponent`
Parameters:
  `active` - Cluster active flag (note: should be used carefully since state can change concurrently).
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### onKernalStop

    public void onKernalStop(boolean cancel)

Callback to notify that kernal is about to stop.

Specified by:
  `onKernalStop` in interface `GridComponent`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

#### onDisconnected

    public void onDisconnected(IgniteFuture<?> reconnectFut)
                        throws IgniteCheckedException

Client disconnected callback.

Specified by:
  `onDisconnected` in interface `GridComponent`
Parameters:
  `reconnectFut` - Reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### onReconnected

    public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
                                          throws IgniteCheckedException

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridComponent`
Parameters:
  `clusterRestarted` - Cluster restarted flag.
Returns:
  Future to wait before completing reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### discoveryDataType

    @Nullable
    public GridComponent.DiscoveryDataExchangeType discoveryDataType()

Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methods `GridComponent.collectJoiningNodeData(DiscoveryDataBag)` or `GridComponent.collectGridNodeData(DiscoveryDataBag)`.

Specified by:
  `discoveryDataType` in interface `GridComponent`
Returns:
  Unique component type for discovery data exchange.

#### collectJoiningNodeData

    public void collectJoiningNodeData(DiscoveryDataBag dataBag)

Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.

Specified by:
  `collectJoiningNodeData` in interface `GridComponent`
Parameters:
  `dataBag` - container object to store discovery data in.

#### collectGridNodeData

    public void collectGridNodeData(DiscoveryDataBag dataBag)

Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.

Specified by:
  `collectGridNodeData` in interface `GridComponent`
Parameters:
  `dataBag` - container object to store discovery data in.

#### onGridDataReceived

    public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)

Receives discovery data object from remote nodes (called on new node during discovery process).

Specified by:
  `onGridDataReceived` in interface `GridComponent`
Parameters:
  `data` - `DiscoveryDataBag.GridDiscoveryData` interface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).

#### onJoiningNodeDataReceived

    public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)

Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.

Specified by:
  `onJoiningNodeDataReceived` in interface `GridComponent`
Parameters:
  `data` - `DiscoveryDataBag.JoiningNodeDiscoveryData` interface to retrieve discovery data of joining node.

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

Specified by:
  `stop` in interface `GridComponent`
Parameters:
  `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### assertParameter

    protected final void assertParameter(boolean cond,
                       String condDesc)
                                  throws IgniteCheckedException

Throws exception with uniform error message if given parameter's assertion condition is `false`.

Parameters:
  `cond` - Assertion condition to check.
  `condDesc` - Description of failed condition. Note that this description should include JavaBean name of the property (not a variable name) as well condition in Java syntax like, for example:

            ...
            assertParameter(dirPath != null, "dirPath != null");
            ...

  Note that in case when variable name is the same as JavaBean property you can just copy Java condition expression into description as a string.
Throws:
  `IgniteCheckedException` - Thrown if given condition is `false`

#### printMemoryStats

    public void printMemoryStats()

Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridComponent`

#### validateNode

    @Nullable
    public IgniteNodeValidationResult validateNode(ClusterNode node)

Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

Specified by:
  `validateNode` in interface `GridComponent`
Parameters:
  `node` - Joining node.
Returns:
  Validation result or `null` in case of success.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017