org.apache.ignite.internal.processors.cluster

## Class GridClusterStateProcessor

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

All Implemented Interfaces:
  GridComponent, GridProcessor

    public class GridClusterStateProcessor
    extends GridProcessorAdapter

### Nested Class Summary

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

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`GridClusterStateProcessor(GridKernalContext ctx)`

### Method Summary

Methods
`void` `cacheProcessorStarted()`
`IgniteInternalFuture<?>` `changeGlobalState(boolean activate)`
`DiscoveryDataClusterState` `clusterState()`
`void` `collectGridNodeData(DiscoveryDataBag dataBag)` Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.
`GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`void` `onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)` Receives discovery data object from remote nodes (called on new node during discovery process).
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`IgniteInternalFuture<Boolean>` `onLocalJoin(DiscoCache discoCache)`
`ChangeGlobalStateFinishMessage` `onNodeLeft(ClusterNode node)`
`void` `onStateChangeError(Map<UUID,Exception> errs, StateChangeRequest req)`
`void` `onStateChangeExchangeDone(StateChangeRequest req)`
`boolean` `onStateChangeMessage(AffinityTopologyVersion topVer, ChangeGlobalStateMessage msg, DiscoCache discoCache)`
`void` `onStateFinishMessage(ChangeGlobalStateFinishMessage msg)`
`boolean` `publicApiActiveState()`
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.
`String` `toString()`

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, collectJoiningNodeData, onDisconnected, onJoiningNodeDataReceived, onKernalStart, onReconnected, printMemoryStats, validateNode`

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

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

### Constructor Detail

#### GridClusterStateProcessor

    public GridClusterStateProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### publicApiActiveState

    public boolean publicApiActiveState()

Returns:
  Cluster state to be used on public API.

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws 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`
Overrides:
  `onKernalStop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

#### onLocalJoin

    @Nullable
    public IgniteInternalFuture<Boolean> onLocalJoin(DiscoCache discoCache)

Parameters:
  `discoCache` - Discovery data cache.
Returns:
  If transition is in progress returns future which is completed when transition finishes.

#### onNodeLeft

    @Nullable
    public ChangeGlobalStateFinishMessage onNodeLeft(ClusterNode node)

Parameters:
  `node` - Failed node.
Returns:
  Message if cluster state changed.

#### onStateFinishMessage

    public void onStateFinishMessage(ChangeGlobalStateFinishMessage msg)

Parameters:
  `msg` - Message.

#### onStateChangeMessage

    public boolean onStateChangeMessage(AffinityTopologyVersion topVer,
                               ChangeGlobalStateMessage msg,
                               DiscoCache discoCache)

Parameters:
  `topVer` - Current topology version.
  `msg` - Message.
  `discoCache` - Current nodes.
Returns:
  `True` if need start state change process.

#### clusterState

    public DiscoveryDataClusterState clusterState()

Returns:
  Current cluster state, should be called only from discovery thread.

#### cacheProcessorStarted

    public void cacheProcessorStarted()

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

Specified by:
  `stop` in interface `GridComponent`
Overrides:
  `stop` in class `GridProcessorAdapter`
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.

#### 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`
Overrides:
  `discoveryDataType` in class `GridProcessorAdapter`
Returns:
  Unique component type for discovery data exchange.

#### collectGridNodeData

    public void collectGridNodeData(DiscoveryDataBag dataBag)

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

Specified by:
  `collectGridNodeData` in interface `GridComponent`
Overrides:
  `collectGridNodeData` in class `GridProcessorAdapter`
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`
Overrides:
  `onGridDataReceived` in class `GridProcessorAdapter`
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).

#### changeGlobalState

    public IgniteInternalFuture<?> changeGlobalState(boolean activate)

Parameters:
  `activate` - New cluster state.
Returns:
  State change future.

#### onStateChangeError

    public void onStateChangeError(Map<UUID,Exception> errs,
                          StateChangeRequest req)

Parameters:
  `errs` - Errors.
  `req` - State change request.

#### onStateChangeExchangeDone

    public void onStateChangeExchangeDone(StateChangeRequest req)

Parameters:
  `req` - State change request.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridProcessorAdapter`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017