org.apache.ignite.internal.processors.marshaller

## Class GridMarshallerMappingProcessor

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

All Implemented Interfaces:
  GridComponent, GridProcessor

    public class GridMarshallerMappingProcessor
    extends GridProcessorAdapter

Processor responsible for managing custom `DiscoveryCustomMessage` events for exchanging marshalling mappings between nodes in grid. In particular it processes two flows:

- Some node, server or client, wants to add new mapping for some class. In that case a pair of `MappingProposedMessage` and `MappingAcceptedMessage` events is used.
- As discovery events are delivered to clients asynchronously, client node may not have some mapping when server nodes in the grid are already allowed to use the mapping. In that situation client sends a `MissingMappingRequestMessage` request and processor handles it as well as `MissingMappingResponseMessage` message.

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

### Constructor Summary

Constructors
Constructor and Description
`GridMarshallerMappingProcessor(GridKernalContext ctx)`

### Method Summary

Methods
`void` `addMappingUpdatedListener(MappingUpdatedListener lsnr)` Adds a listener to be notified when mapping changes.
`void` `collectGridNodeData(DiscoveryDataBag dataBag)` Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.
`Iterator<Map.Entry<Byte,Map<Integer,String>>>` `currentMappings()` Gets an iterator over all current mappings.
`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` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`void` `start(boolean activeOnStart)` Starts grid component.

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

`assertParameter, collectJoiningNodeData, onJoiningNodeDataReceived, onKernalStart, onReconnected, printMemoryStats, stop, toString, validateNode`

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

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

### Constructor Detail

#### GridMarshallerMappingProcessor

    public GridMarshallerMappingProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### start

    public void start(boolean activeOnStart)
               throws IgniteCheckedException

Starts grid component.

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

#### addMappingUpdatedListener

    public void addMappingUpdatedListener(MappingUpdatedListener lsnr)

Adds a listener to be notified when mapping changes.

Parameters:
  `lsnr` - listener for mapping updated events.

#### currentMappings

    public Iterator<Map.Entry<Byte,Map<Integer,String>>> currentMappings()

Gets an iterator over all current mappings.

Returns:
  Iterator over current mappings.

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

#### onDisconnected

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

Client disconnected callback.

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

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

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

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017