org.apache.ignite.internal.managers

## Class GridManagerAdapter<T extends IgniteSpi>

- java.lang.Object
- - org.apache.ignite.internal.managers.GridManagerAdapter<T>

Type Parameters:
  `T` - SPI wrapped by this manager.

All Implemented Interfaces:
  GridComponent, GridManager

Direct Known Subclasses:
  GridCheckpointManager, GridCollisionManager, GridDeploymentManager, GridDiscoveryManager, GridEventStorageManager, GridFailoverManager, GridIndexingManager, GridIoManager, GridLoadBalancerManager, GridSwapSpaceManager

    public abstract class GridManagerAdapter<T extends IgniteSpi>
    extends Object
    implements GridManager

Convenience adapter for grid managers.

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

### Constructor Summary

Constructors
`protected` `GridManagerAdapter(GridKernalContext ctx, T... spis)`

### Method Summary

Methods
`protected void` `assertParameter(boolean cond, String condDesc)` Throws exception with uniform error message if given parameter's assertion condition is `false`.
`Object` `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.
`boolean` `enabled()`
`protected T` `getSpi()` Gets wrapped SPI.
`protected T` `getSpi(String name)`
`protected T[]` `getSpis()`
`void` `onAfterSpiStart()` This method executed after manager started SPI.
`void` `onBeforeSpiStart()` This method executed before manager will start SPI.
`void` `onDiscoveryDataReceived(UUID joiningNodeId, UUID rmtNodeId, Object 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.
`protected void` `onKernalStart0()`
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`protected void` `onKernalStop0(boolean cancel)`
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`protected String` `startInfo()`
`protected void` `startSpi()` Starts wrapped SPI.
`protected String` `stopInfo()`
`protected void` `stopSpi()` Stops wrapped SPI.
`String` `toString()`
`IgniteSpiNodeValidationResult` `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`

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

`start, stop`

### Field Detail

#### ctx

    @GridToStringExclude
    protected final GridKernalContext ctx

Kernal context.

#### log

    @GridToStringExclude
    protected final IgniteLogger log

Logger.

### Constructor Detail

#### GridManagerAdapter

    protected GridManagerAdapter(GridKernalContext ctx,
                      T... spis)

Parameters:
  `ctx` - Kernal context.
  `spis` - Specific SPI instance.

### Method Detail

#### getSpi

    protected final T getSpi()

Gets wrapped SPI.

Returns:
  Wrapped SPI.

#### getSpi

    protected final T getSpi(@Nullable
           String name)

Parameters:
  `name` - SPI name
Returns:
  SPI for given name. If `null` or empty, then 1st SPI on the list is returned.

#### enabled

    public boolean enabled()

Specified by:
  `enabled` in interface `GridManager`
Returns:
  `true` if at least one SPI does not have a `NO-OP` implementation, `false` otherwise.

#### getSpis

    protected final T[] getSpis()

Returns:
  Configured SPI's.

#### onBeforeSpiStart

    public void onBeforeSpiStart()

This method executed before manager will start SPI.

Specified by:
  `onBeforeSpiStart` in interface `GridManager`

#### onAfterSpiStart

    public void onAfterSpiStart()

This method executed after manager started SPI.

Specified by:
  `onAfterSpiStart` in interface `GridManager`

#### startSpi

    protected final void startSpi()
                           throws IgniteCheckedException

Starts wrapped SPI.

Throws:
  `IgniteCheckedException` - If wrapped SPI could not be started.

#### stopSpi

    protected final void stopSpi()
                          throws IgniteCheckedException

Stops wrapped SPI.

Throws:
  `IgniteCheckedException` - If underlying SPI could not be stopped.

#### startInfo

    protected final String startInfo()

Returns:
  Uniformly formatted ack string.

#### stopInfo

    protected final String stopInfo()

Returns:
  Uniformly formatted ack string.

#### onKernalStart

    public final 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 final 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 Object 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,
                               Object 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

#### onKernalStart0

    protected void onKernalStart0()
                           throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStop0

    protected void onKernalStop0(boolean cancel)

Parameters:
  `cancel` - Cancel flag.

#### 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 IgniteSpiNodeValidationResult 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 final String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0
Release Date | : March 31 2015