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, GridClockSyncProcessor, GridClosureProcessor, GridContinuousProcessor, GridJobMetricsProcessor, GridJobProcessor, GridOffHeapProcessor, GridOsSecurityProcessor, GridOsSegmentationProcessor, GridPortProcessor, GridQueryProcessor, GridResourceProcessor, GridRestProcessor, GridServiceProcessor, GridTaskProcessor, GridTaskSessionProcessor, GridTimeoutProcessor, HadoopProcessorAdapter, IgfsProcessorAdapter, IgniteCacheObjectProcessorImpl, IgnitePluginProcessor, IgniteScheduleProcessorAdapter, OsDiscoveryNodeValidationProcessor

    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` `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`.
`Serializable` `collectDiscoveryData(UUID nodeId)` Gets discovery data object that will be sent to new node during discovery process.
`GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`void` `onDiscoveryDataReceived(UUID joiningNodeId, UUID rmtNodeId, Serializable data)` Receives discovery data object from remote nodes (called on new node during discovery process).
`void` `onKernalStart()` 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.
`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.

### Constructor Detail

#### GridProcessorAdapter

    protected GridProcessorAdapter(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### onKernalStart

    public void onKernalStart()
                       throws IgniteCheckedException

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

Specified by:
  `onKernalStart` in interface `GridComponent`
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.

#### discoveryDataType

    @Nullable
    public GridComponent.DiscoveryDataExchangeType discoveryDataType()

Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements method `GridComponent.collectDiscoveryData(UUID)`.

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

#### collectDiscoveryData

    @Nullable
    public Serializable collectDiscoveryData(UUID nodeId)

Gets discovery data object that will be sent to new node during discovery process.

Specified by:
  `collectDiscoveryData` in interface `GridComponent`
Parameters:
  `nodeId` - ID of new node that joins topology.
Returns:
  Discovery data object or `null` if there is nothing to send for this component.

#### onDiscoveryDataReceived

    public void onDiscoveryDataReceived(UUID joiningNodeId,
                               UUID rmtNodeId,
                               Serializable data)

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

Specified by:
  `onDiscoveryDataReceived` in interface `GridComponent`
Parameters:
  `joiningNodeId` - Joining node ID.
  `rmtNodeId` - Remote node ID for which data is provided.
  `data` - Discovery data object or `null` if nothing was

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

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015