org.apache.ignite.internal.processors.cluster

## Class ClusterProcessor

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

All Implemented Interfaces:
  GridComponent, GridProcessor, DistributedMetastorageLifecycleListener

    public class ClusterProcessor
    extends GridProcessorAdapter
    implements DistributedMetastorageLifecycleListener

### 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
`ClusterProcessor(GridKernalContext ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`IgniteFuture<?>` `clientReconnectFuture()`
`String` `clusterName()` Get cluster name.
`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.
`boolean` `diagnosticEnabled()`
`IgniteLogger` `diagnosticLog()`
`void` `disableUpdateNotifier()` Disables update notifier.
`@Nullable GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`IgniteClusterImpl` `get()`
`void` `initDiagnosticListeners()`
`String` `latestVersion()`
`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` `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.
`void` `onLocalJoin()` Node makes ID and tag available through public API on local join event.
`void` `onReadyForRead(ReadableDistributedMetaStorage metastorage)` Called when global metastorage is ready for reading.
`void` `onReadyForWrite(DistributedMetaStorage metastorage)` Called when global metastorage is available for writing.
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`IgniteInternalFuture<String>` `requestDiagnosticInfo(UUID nodeId, IgniteClosure<GridKernalContext,IgniteDiagnosticInfo> c, String baseMsg)` Sends diagnostic message closure to remote node.
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.
`boolean` `updateNotifierEnabled()`
`void` `updateTag(String newTag)` Method is called when user requests updating tag through public API.

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

`assertParameter, onJoiningNodeDataReceived, printMemoryStats, toString, validateNode, validateNode`

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

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

### Constructor Detail

#### ClusterProcessor

    public ClusterProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### diagnosticEnabled

    public boolean diagnosticEnabled()

Returns:
  Diagnostic flag.

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

#### onReadyForRead

    public void onReadyForRead(ReadableDistributedMetaStorage metastorage)

Called when global metastorage is ready for reading.
Normally this is the place where you should add listeners and read required data. Note that this data might be outdated.

Specified by:
  `onReadyForRead` in interface `DistributedMetastorageLifecycleListener`
Parameters:
  `metastorage` - Read-only global metastorage.
See Also:
  `DistributedMetaStorageListener`

#### onReadyForWrite

    public void onReadyForWrite(DistributedMetaStorage metastorage)

Called when global metastorage is available for writing. In persistent mode this method will be invoked every time cluster is reactivated.

Specified by:
  `onReadyForWrite` in interface `DistributedMetastorageLifecycleListener`
Parameters:
  `metastorage` - Global metastorage instance.

#### updateTag

    public void updateTag(String newTag)
                   throws IgniteCheckedException

Method is called when user requests updating tag through public API.

Parameters:
  `newTag` - New tag.
Throws:
  `IgniteCheckedException`

#### onLocalJoin

    public void onLocalJoin()

Node makes ID and tag available through public API on local join event. Two cases.

- In in-memory scenario very first node of the cluster generates ID and tag, other nodes receives them on join.
- When persistence is enabled each node reads ID and tag from metastorage when it becomes ready for read.

#### onDisconnected

    public void onDisconnected(IgniteFuture<?> reconnectFut)

Client disconnected callback.

Specified by:
  `onDisconnected` in interface `GridComponent`
Overrides:
  `onDisconnected` in class `GridProcessorAdapter`
Parameters:
  `reconnectFut` - Reconnect future.

#### onReconnected

    public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridComponent`
Overrides:
  `onReconnected` in class `GridProcessorAdapter`
Parameters:
  `clusterRestarted` - Cluster restarted flag.
Returns:
  Future to wait before completing reconnect future.

#### initDiagnosticListeners

    public void initDiagnosticListeners()
                                 throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### diagnosticLog

    public IgniteLogger diagnosticLog()

Returns:
  Logger for diagnostic category.

#### get

    public IgniteClusterImpl get()

Returns:
  Cluster.

#### clientReconnectFuture

    public IgniteFuture<?> clientReconnectFuture()

Returns:
  Client reconnect future.

#### discoveryDataType

    @Nullable
    public @Nullable 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.

#### collectJoiningNodeData

    public void collectJoiningNodeData(DiscoveryDataBag dataBag)

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

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

#### 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`
Overrides:
  `onKernalStart` in class `GridProcessorAdapter`
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`
Overrides:
  `onKernalStop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

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

#### disableUpdateNotifier

    public void disableUpdateNotifier()

Disables update notifier.

#### updateNotifierEnabled

    public boolean updateNotifierEnabled()

Returns:
  Update notifier status.

#### latestVersion

    public String latestVersion()

Returns:
  Latest version string.

#### clusterName

    public String clusterName()

Get cluster name.

Returns:
  Cluster name.

#### requestDiagnosticInfo

    public IgniteInternalFuture<String> requestDiagnosticInfo(UUID nodeId,
                                                              IgniteClosure<GridKernalContext,IgniteDiagnosticInfo> c,
                                                              String baseMsg)

Sends diagnostic message closure to remote node. When response received dumps remote message and local communication info about connection(s) with remote node.

Parameters:
  `nodeId` - Target node ID.
  `c` - Closure to send.
  `baseMsg` - Local message to log.
Returns:
  Message future.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020