org.apache.ignite.internal.managers.communication

## Class GridIoManager

- java.lang.Object
- - org.apache.ignite.internal.managers.GridManagerAdapter<CommunicationSpi<Serializable>>
  - - org.apache.ignite.internal.managers.communication.GridIoManager

All Implemented Interfaces:
  GridComponent, GridManager

    public class GridIoManager
    extends GridManagerAdapter<CommunicationSpi<Serializable>>

Grid communication manager.

### Nested Class Summary

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

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`static byte` `DIRECT_PROTO_VER` Direct protocol version.
`static String` `DIRECT_PROTO_VER_ATTR` Direct protocol version attribute name.
`static MessageFactory[]` `EMPTY` Empty array of message factories.
`static int` `MAX_CLOSED_TOPICS` Max closed topics to store.

### Fields inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`ctx, log`

### Constructor Summary

Constructors
Constructor and Description
`GridIoManager(GridKernalContext ctx)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addDisconnectListener(GridDisconnectListener lsnr)`
`void` `addMessageListener(GridTopic topic, GridMessageListener lsnr)`
`void` `addMessageListener(Object topic, GridMessageListener lsnr)`
`void` `addUserMessageListener(Object topic, IgniteBiPredicate<UUID,?> p)`
`boolean` `checkNodeLeft(UUID nodeId, IgniteCheckedException sndErr, boolean ping)`
`static Byte` `currentPolicy()`
`void` `dumpStats()` Dumps SPI stats to diagnostic logs in case TcpCommunicationSpi is used, no-op otherwise.
`MessageFormatter` `formatter()`
`int` `getOutboundMessagesQueueSize()` Gets outbound messages queue size.
`long` `getReceivedBytesCount()` Gets received bytes count.
`int` `getReceivedMessagesCount()` Gets received messages count.
`long` `getSentBytesCount()` Gets sent bytes count.
`int` `getSentMessagesCount()` Gets sent messages count.
`MessageFactory` `messageFactory()`
`void` `onKernalStart0()`
`void` `onKernalStop0(boolean cancel)`
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`void` `removeDisconnectListener(GridDisconnectListener lsnr)`
`boolean` `removeMessageListener(GridTopic topic)`
`boolean` `removeMessageListener(GridTopic topic, GridMessageListener lsnr)`
`boolean` `removeMessageListener(Object topic)`
`boolean` `removeMessageListener(Object topic, GridMessageListener lsnr)`
`void` `removeUserMessageListener(Object topic, IgniteBiPredicate<UUID,?> p)`
`void` `resetMetrics()` Resets metrics for this manager.
`void` `runIoTest(long warmup, long duration, int threads, long latencyLimit, int rangesCnt, int payLoadSize, boolean procFromNioThread, List<ClusterNode> nodes)`
`void` `sendGeneric(ClusterNode node, Object topic, int topicOrd, Message msg, byte plc)`
`IgniteInternalFuture<List<IgniteIoTestMessage>>` `sendIoTest(ClusterNode node, byte[] payload, boolean procFromNioThread)`
`IgniteInternalFuture` `sendIoTest(List<ClusterNode> nodes, byte[] payload, boolean procFromNioThread)`
`void` `sendOrderedMessage(ClusterNode node, Object topic, Message msg, byte plc, long timeout, boolean skipOnTimeout)`
`void` `sendOrderedMessage(ClusterNode node, Object topic, Message msg, byte plc, long timeout, boolean skipOnTimeout, IgniteInClosure<IgniteException> ackC)`
`void` `sendToCustomTopic(ClusterNode node, Object topic, Message msg, byte plc)`
`void` `sendToCustomTopic(UUID nodeId, Object topic, Message msg, byte plc)`
`void` `sendToGridTopic(ClusterNode node, GridTopic topic, Message msg, byte plc)`
`void` `sendToGridTopic(ClusterNode node, GridTopic topic, Message msg, byte plc, IgniteInClosure<IgniteException> ackC)`
`void` `sendToGridTopic(Collection<? extends ClusterNode> nodes, GridTopic topic, Message msg, byte plc)`
`void` `sendToGridTopic(UUID nodeId, GridTopic topic, Message msg, byte plc)`
`void` `sendUserMessage(Collection<? extends ClusterNode> nodes, Object msg, Object topic, boolean ordered, long timeout, boolean async)` Sends a peer deployable user message.
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.

### Methods inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, enabled, getSpi, getSpi, getSpis, inject, onAfterSpiStart, onBeforeSpiStart, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onKernalStop, onReconnected, startInfo, startSpi, stopInfo, stopSpi, toString, validateNode, validateNode`

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

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

### Field Detail

#### EMPTY

    public static final MessageFactory[] EMPTY

Empty array of message factories.

#### MAX_CLOSED_TOPICS

    public static final int MAX_CLOSED_TOPICS

Max closed topics to store.

See Also:
  Constant Field Values

#### DIRECT_PROTO_VER_ATTR

    public static final String DIRECT_PROTO_VER_ATTR

Direct protocol version attribute name.

See Also:
  Constant Field Values

#### DIRECT_PROTO_VER

    public static final byte DIRECT_PROTO_VER

Direct protocol version.

See Also:
  Constant Field Values

### Constructor Detail

#### GridIoManager

    public GridIoManager(GridKernalContext ctx)

Parameters:
  `ctx` - Grid kernal context.

### Method Detail

#### messageFactory

    public MessageFactory messageFactory()

Returns:
  Message factory.

#### formatter

    public MessageFormatter formatter()

Returns:
  Message writer factory.

#### resetMetrics

    public void resetMetrics()

Resets metrics for this manager.

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### sendIoTest

    public IgniteInternalFuture sendIoTest(List<ClusterNode> nodes,
                                           byte[] payload,
                                           boolean procFromNioThread)

Parameters:
  `nodes` - Nodes.
  `payload` - Payload.
  `procFromNioThread` - If `true` message is processed from NIO thread.
Returns:
  Response future.

#### sendIoTest

    public IgniteInternalFuture<List<IgniteIoTestMessage>> sendIoTest(ClusterNode node,
                                                                      byte[] payload,
                                                                      boolean procFromNioThread)

Parameters:
  `node` - Node.
  `payload` - Payload.
  `procFromNioThread` - If `true` message is processed from NIO thread.
Returns:
  Response future.

#### runIoTest

    public void runIoTest(long warmup,
                          long duration,
                          int threads,
                          long latencyLimit,
                          int rangesCnt,
                          int payLoadSize,
                          boolean procFromNioThread,
                          List<ClusterNode> nodes)

Parameters:
  `warmup` - Warmup duration in milliseconds.
  `duration` - Test duration in milliseconds.
  `threads` - Thread count.
  `latencyLimit` - Max latency in nanoseconds.
  `rangesCnt` - Ranges count in resulting histogram.
  `payLoadSize` - Payload size in bytes.
  `procFromNioThread` - `True` to process requests in NIO threads.
  `nodes` - Nodes participating in test.

#### onKernalStart0

    public void onKernalStart0()
                        throws IgniteCheckedException

Overrides:
  `onKernalStart0` in class `GridManagerAdapter<CommunicationSpi<Serializable>>`
Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStop0

    public void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `GridManagerAdapter<CommunicationSpi<Serializable>>`
Parameters:
  `cancel` - Cancel flag.

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

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.

#### currentPolicy

    @Nullable
    public static Byte currentPolicy()

Returns:
  Current IO policy

#### checkNodeLeft

    public boolean checkNodeLeft(UUID nodeId,
                                 IgniteCheckedException sndErr,
                                 boolean ping)
                          throws IgniteClientDisconnectedCheckedException

Parameters:
  `nodeId` - Node ID.
  `sndErr` - Send error.
  `ping` - `True` if try ping node.
Returns:
  `True` if node left.
Throws:
  `IgniteClientDisconnectedCheckedException` - If ping failed.

#### sendToCustomTopic

    public void sendToCustomTopic(UUID nodeId,
                                  Object topic,
                                  Message msg,
                                  byte plc)
                           throws IgniteCheckedException

Parameters:
  `nodeId` - Id of destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendToGridTopic

    public void sendToGridTopic(UUID nodeId,
                                GridTopic topic,
                                Message msg,
                                byte plc)
                         throws IgniteCheckedException

Parameters:
  `nodeId` - Id of destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendToCustomTopic

    public void sendToCustomTopic(ClusterNode node,
                                  Object topic,
                                  Message msg,
                                  byte plc)
                           throws IgniteCheckedException

Parameters:
  `node` - Destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendToGridTopic

    public void sendToGridTopic(ClusterNode node,
                                GridTopic topic,
                                Message msg,
                                byte plc)
                         throws IgniteCheckedException

Parameters:
  `node` - Destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendGeneric

    public void sendGeneric(ClusterNode node,
                            Object topic,
                            int topicOrd,
                            Message msg,
                            byte plc)
                     throws IgniteCheckedException

Parameters:
  `node` - Destination node.
  `topic` - Topic to send the message to.
  `topicOrd` - GridTopic enumeration ordinal.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendOrderedMessage

    public void sendOrderedMessage(ClusterNode node,
                                   Object topic,
                                   Message msg,
                                   byte plc,
                                   long timeout,
                                   boolean skipOnTimeout)
                            throws IgniteCheckedException

Parameters:
  `node` - Destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
  `timeout` - Timeout to keep a message on receiving queue.
  `skipOnTimeout` - Whether message can be skipped on timeout.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendToGridTopic

    public void sendToGridTopic(ClusterNode node,
                                GridTopic topic,
                                Message msg,
                                byte plc,
                                IgniteInClosure<IgniteException> ackC)
                         throws IgniteCheckedException

Parameters:
  `node` - Destination nodes.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
  `ackC` - Ack closure.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendToGridTopic

    public void sendToGridTopic(Collection<? extends ClusterNode> nodes,
                                GridTopic topic,
                                Message msg,
                                byte plc)
                         throws IgniteCheckedException

Parameters:
  `nodes` - Destination nodes.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendOrderedMessage

    public void sendOrderedMessage(ClusterNode node,
                                   Object topic,
                                   Message msg,
                                   byte plc,
                                   long timeout,
                                   boolean skipOnTimeout,
                                   IgniteInClosure<IgniteException> ackC)
                            throws IgniteCheckedException

Parameters:
  `node` - Destination node.
  `topic` - Topic to send the message to.
  `msg` - Message to send.
  `plc` - Type of processing.
  `timeout` - Timeout to keep a message on receiving queue.
  `skipOnTimeout` - Whether message can be skipped on timeout.
  `ackC` - Ack closure.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### sendUserMessage

    public void sendUserMessage(Collection<? extends ClusterNode> nodes,
                                Object msg,
                                @Nullable
                                Object topic,
                                boolean ordered,
                                long timeout,
                                boolean async)
                         throws IgniteCheckedException

Sends a peer deployable user message.

Parameters:
  `nodes` - Destination nodes.
  `msg` - Message to send.
  `topic` - Message topic to use.
  `ordered` - Is message ordered?
  `timeout` - Message timeout in milliseconds for ordered messages.
  `async` - Async flag.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### addUserMessageListener

    public void addUserMessageListener(@Nullable
                                       Object topic,
                                       @Nullable
                                       IgniteBiPredicate<UUID,?> p)

Parameters:
  `topic` - Topic to subscribe to.
  `p` - Message predicate.

#### removeUserMessageListener

    public void removeUserMessageListener(@Nullable
                                          Object topic,
                                          IgniteBiPredicate<UUID,?> p)

Parameters:
  `topic` - Topic to unsubscribe from.
  `p` - Message predicate.

#### addMessageListener

    public void addMessageListener(GridTopic topic,
                                   GridMessageListener lsnr)

Parameters:
  `topic` - Listener's topic.
  `lsnr` - Listener to add.

#### addDisconnectListener

    public void addDisconnectListener(GridDisconnectListener lsnr)

Parameters:
  `lsnr` - Listener to add.

#### removeDisconnectListener

    public void removeDisconnectListener(GridDisconnectListener lsnr)

Parameters:
  `lsnr` - Listener to remove.

#### addMessageListener

    public void addMessageListener(Object topic,
                                   GridMessageListener lsnr)

Parameters:
  `topic` - Listener's topic.
  `lsnr` - Listener to add.

#### removeMessageListener

    public boolean removeMessageListener(GridTopic topic)

Parameters:
  `topic` - Message topic.
Returns:
  Whether or not listener was indeed removed.

#### removeMessageListener

    public boolean removeMessageListener(Object topic)

Parameters:
  `topic` - Message topic.
Returns:
  Whether or not listener was indeed removed.

#### removeMessageListener

    public boolean removeMessageListener(GridTopic topic,
                                         @Nullable
                                         GridMessageListener lsnr)

Parameters:
  `topic` - Listener's topic.
  `lsnr` - Listener to remove.
Returns:
  Whether or not the lsnr was removed.

#### removeMessageListener

    public boolean removeMessageListener(Object topic,
                                         @Nullable
                                         GridMessageListener lsnr)

Parameters:
  `topic` - Listener's topic.
  `lsnr` - Listener to remove.
Returns:
  Whether or not the lsnr was removed.

#### getSentMessagesCount

    public int getSentMessagesCount()

Gets sent messages count.

Returns:
  Sent messages count.

#### getSentBytesCount

    public long getSentBytesCount()

Gets sent bytes count.

Returns:
  Sent bytes count.

#### getReceivedMessagesCount

    public int getReceivedMessagesCount()

Gets received messages count.

Returns:
  Received messages count.

#### getReceivedBytesCount

    public long getReceivedBytesCount()

Gets received bytes count.

Returns:
  Received bytes count.

#### getOutboundMessagesQueueSize

    public int getOutboundMessagesQueueSize()

Gets outbound messages queue size.

Returns:
  Outbound messages queue size.

#### dumpStats

    public void dumpStats()

Dumps SPI stats to diagnostic logs in case TcpCommunicationSpi is used, no-op otherwise.

#### 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`
Overrides:
  `printMemoryStats` in class `GridManagerAdapter<CommunicationSpi<Serializable>>`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.5
Release Date | : June 4 2019