org.apache.ignite.spi.communication.tcp

## Class TcpCommunicationSpi

- java.lang.Object
- - org.apache.ignite.spi.IgniteSpiAdapter
  - - org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi

- All Implemented Interfaces:
    CommunicationSpi<Message>, IgniteSpi

      @IgniteSpiMultipleInstancesSupport(value=true)
       @IgniteSpiConsistencyChecked(optional=false)
      public class TcpCommunicationSpi
      extends IgniteSpiAdapter
      implements CommunicationSpi<Message>

  `TcpCommunicationSpi` is default communication SPI which uses TCP/IP protocol and Java NIO to communicate with other nodes.

  To enable communication with other nodes, this SPI adds `ATTR_ADDRS` and `ATTR_PORT` local node attributes (see `ClusterNode.attributes()`.

  At startup, this SPI tries to start listening to local port specified by `setLocalPort(int)` method. If local port is occupied, then SPI will automatically increment the port number until it can successfully bind for listening. `setLocalPortRange(int)` configuration parameter controls maximum number of ports that SPI will try before it fails. Port range comes very handy when starting multiple grid nodes on the same machine or even in the same VM. In this case all nodes can be brought up without a single change in configuration.

  This SPI caches connections to remote nodes so it does not have to reconnect every time a message is sent. By default, idle connections are kept active for `DFLT_IDLE_CONN_TIMEOUT` period and then are closed. Use `setIdleConnectionTimeout(long)` configuration parameter to configure you own idle connection timeout.

  # Failure Detection

  Configuration defaults (see Configuration section below and `IgniteConfiguration.getFailureDetectionTimeout()`) for details) are chosen to make possible for communication SPI work reliably on most of hardware and virtual deployments, but this has made failure detection time worse.

  If it's needed to tune failure detection then it's highly recommended to do this using `IgniteConfiguration.setFailureDetectionTimeout(long)`. This failure timeout automatically controls the following parameters: `getConnectTimeout()`, `getMaxConnectTimeout()`, `getReconnectCount()`. If any of those parameters is set explicitly, then the failure timeout setting will be ignored.

  If it's required to perform advanced settings of failure detection and `IgniteConfiguration.getFailureDetectionTimeout()` is unsuitable then various `TcpCommunicationSpi` configuration parameters may be used.

  # Configuration

  ## Mandatory

  This SPI has no mandatory configuration parameters.

  ## Optional

  The following configuration parameters are optional:
  - Address resolver (see `setAddressResolver(AddressResolver)`
  - Node local IP address (see `setLocalAddress(String)`)
  - Node local port number (see `setLocalPort(int)`)
  - Local port range (see `setLocalPortRange(int)`
  - Use paired connections (see `setUsePairedConnections(boolean)`
  - Connections per node (see `setConnectionsPerNode(int)`)
  - Shared memory port (see `setSharedMemoryPort(int)`
  - Idle connection timeout (see `setIdleConnectionTimeout(long)`)
  - Direct or heap buffer allocation (see `setDirectBuffer(boolean)`)
  - Direct or heap buffer allocation for sending (see `setDirectSendBuffer(boolean)`)
  - Count of selectors and selector threads for NIO server (see `setSelectorsCount(int)`)
  - Selector thread busy-loop iterations (see `setSelectorSpins(long)`
  - `TCP_NODELAY` socket option for sockets (see `setTcpNoDelay(boolean)`)
  - Filter reachable addresses (see `setFilterReachableAddresses(boolean)`
  - Message queue limit (see `setMessageQueueLimit(int)`)
  - Slow client queue limit (see `setSlowClientQueueLimit(int)`)
  - Connect timeout (see `setConnectTimeout(long)`)
  - Maximum connect timeout (see `setMaxConnectTimeout(long)`)
  - Reconnect attempts count (see `setReconnectCount(int)`)
  - Socket receive buffer size (see `setSocketReceiveBuffer(int)`)
  - Socket send buffer size (see `setSocketSendBuffer(int)`)
  - Socket write timeout (see `setSocketWriteTimeout(long)`)
  - Number of received messages after which acknowledgment is sent (see `setAckSendThreshold(int)`)
  - Maximum number of unacknowledged messages (see `setUnacknowledgedMessagesBufferSize(int)`)

  ## Java Example

  TcpCommunicationSpi is used by default and should be explicitly configured only if some SPI configuration parameters need to be overridden.

       TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

       // Override local port.
       commSpi.setLocalPort(4321);

       IgniteConfiguration cfg = new IgniteConfiguration();

       // Override default communication SPI.
       cfg.setCommunicationSpi(commSpi);

       // Start grid.
       Ignition.start(cfg);

  ## Spring Example

  TcpCommunicationSpi can be configured from Spring XML configuration file:

       <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true">
               ...
               <property name="communicationSpi">
                   <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
                       <!-- Override local port. -->
                       <property name="localPort" value="4321"/>
                   </bean>
               </property>
               ...
       </bean>

  For information about Spring framework visit www.springframework.org

  See Also:
    `CommunicationSpi`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ATTR_ADDRS` Node attribute that is mapped to node IP addresses (value is `comm.tcp.addrs`).
    `static String` | `ATTR_EXT_ADDRS` Node attribute that is mapped to node's external addresses (value is `comm.tcp.ext-addrs`).
    `static String` | `ATTR_FORCE_CLIENT_SERVER_CONNECTIONS`
    `static String` | `ATTR_HOST_NAMES` Node attribute that is mapped to node host names (value is `comm.tcp.host.names`).
    `static String` | `ATTR_PAIRED_CONN`
    `static String` | `ATTR_PORT` Node attribute that is mapped to node port number (value is `comm.tcp.port`).
    `static String` | `ATTR_SHMEM_PORT` Node attribute that is mapped to node port number (value is `comm.shmem.tcp.port`).
    `static String` | `COMMUNICATION_METRICS_GROUP_NAME` Communication metrics group name.
    `static int` | `CONN_IDX_META` Connection index meta for session.
    `static int` | `CONSISTENT_ID_META` Node consistent id meta for session.
    `static int` | `DFLT_ACK_SND_THRESHOLD` Default received messages threshold for sending ack.
    `static int` | `DFLT_CONN_PER_NODE` Default connections per node.
    `static long` | `DFLT_CONN_TIMEOUT` Default connection timeout (value is `5000`ms).
    `static boolean` | `DFLT_FILTER_REACHABLE_ADDRESSES` Default value for `FILTER_REACHABLE_ADDRESSES` socket option (value is `false`).
    `static long` | `DFLT_IDLE_CONN_TIMEOUT` Default idle connection timeout (value is `10`min).
    `static long` | `DFLT_MAX_CONN_TIMEOUT` Default Maximum connection timeout (value is `600,000`ms).
    `static int` | `DFLT_MSG_QUEUE_LIMIT` Default message queue limit per connection (for incoming and outgoing .
    `static int` | `DFLT_PORT` Default port which node sets listener to (value is `47100`).
    `static int` | `DFLT_PORT_RANGE` Default local port range (value is `100`).
    `static int` | `DFLT_RECONNECT_CNT` Default reconnect attempts count (value is `10`).
    `static int` | `DFLT_SELECTORS_CNT` Default count of selectors for TCP server equals to `"Math.max(4, Runtime.getRuntime().availableProcessors() / 2)"`.
    `static int` | `DFLT_SHMEM_PORT` Default port which node sets listener for shared memory connections (value is `48100`).
    `static int` | `DFLT_SOCK_BUF_SIZE` Default socket send and receive buffer size.
    `static long` | `DFLT_SOCK_WRITE_TIMEOUT` Default socket write timeout.
    `static boolean` | `DFLT_TCP_NODELAY` Default value for `TCP_NODELAY` socket option (value is `true`).
    `static Integer` | `DISABLED_CLIENT_PORT` Client nodes might have port `0` if they have no server socket opened.
    `static short` | `HANDSHAKE_MSG_TYPE` Handshake message type.
    `static short` | `HANDSHAKE_WAIT_MSG_TYPE` Handshake wait message type.
    `static int` | `MAX_CONN_PER_NODE` Maximum `GridNioSession` connections per node.
    `static short` | `NODE_ID_MSG_TYPE` Node ID message type.
    `static String` | `OUT_OF_RESOURCES_TCP_MSG` IPC error message.
    `static String` | `RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC`
    `static String` | `RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME`
    `static String` | `RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC`
    `static String` | `RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME`
    `static String` | `RECEIVED_MESSAGES_METRIC_DESC`
    `static String` | `RECEIVED_MESSAGES_METRIC_NAME`
    `static short` | `RECOVERY_LAST_ID_MSG_TYPE` Recovery last received ID message type.
    `static String` | `SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC`
    `static String` | `SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME`
    `static String` | `SENT_MESSAGES_BY_TYPE_METRIC_DESC`
    `static String` | `SENT_MESSAGES_BY_TYPE_METRIC_NAME`
    `static String` | `SENT_MESSAGES_METRIC_DESC`
    `static String` | `SENT_MESSAGES_METRIC_NAME`
    `protected org.apache.ignite.internal.processors.tracing.Tracing` | `tracing` Tracing.

    - ### Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `ignite, igniteInstanceName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TcpCommunicationSpi()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `boundPort()`
    `protected void` | `checkConfigurationConsistency0(IgniteSpiContext spiCtx, ClusterNode node, boolean starting)` Method which is called in the end of checkConfigurationConsistency() method.
    `IgniteFuture<BitSet>` | `checkConnection(List<ClusterNode> nodes)`
    `protected org.apache.ignite.internal.util.nio.GridCommunicationClient` | `createTcpClient(ClusterNode node, int connIdx)` Establish TCP connection to remote node and returns client.
    `org.apache.ignite.internal.IgniteInternalFuture<String>` | `dumpNodeStatistics(UUID nodeId)`
    `void` | `dumpStats()` Dumps SPI per-connection stats to logs.
    `boolean` | `forceClientToServerConnections()`
    `int` | `getAckSendThreshold()` See `setAckSendThreshold(int)`.
    `AddressResolver` | `getAddressResolver()` See `setAddressResolver(AddressResolver)`.
    `int` | `getConnectionsPerNode()` See `setConnectionsPerNode(int)`.
    `long` | `getConnectTimeout()` See `setConnectTimeout(long)`.
    `long` | `getIdleConnectionTimeout()` See `setIdleConnectionTimeout(long)`.
    `CommunicationListener` | `getListener()`
    `String` | `getLocalAddress()` See `setLocalAddress(String)`.
    `int` | `getLocalPort()` See `setLocalPort(int)`.
    `int` | `getLocalPortRange()` See `setLocalPortRange(int)`.
    `long` | `getMaxConnectTimeout()` Gets maximum connect timeout.
    `int` | `getMessageQueueLimit()` Gets message queue limit for incoming and outgoing messages.
    `Map<String,Object>` | `getNodeAttributes()` This method is called before SPI starts (before method `IgniteSpi.spiStart(String)` is called).
    `int` | `getOutboundMessagesQueueSize()` Gets outbound messages queue size.
    `long` | `getReceivedBytesCount()` Gets received bytes count.
    `Map<UUID,Long>` | `getReceivedMessagesByNode()` Gets received messages counts (grouped by node).
    `Map<String,Long>` | `getReceivedMessagesByType()` Gets received messages counts (grouped by type).
    `int` | `getReceivedMessagesCount()` Gets received messages count.
    `int` | `getReconnectCount()` Gets maximum number of reconnect attempts used when establishing connection with remote nodes.
    `int` | `getSelectorsCount()` See `setSelectorsCount(int)`.
    `long` | `getSelectorSpins()` See `setSelectorSpins(long)`.
    `long` | `getSentBytesCount()` Gets sent bytes count.
    `Map<UUID,Long>` | `getSentMessagesByNode()` Gets sent messages counts (grouped by node).
    `Map<String,Long>` | `getSentMessagesByType()` Gets sent messages counts (grouped by type).
    `int` | `getSentMessagesCount()` Gets sent messages count.
    `int` | `getSharedMemoryPort()` See `setSharedMemoryPort(int)`.
    `int` | `getSlowClientQueueLimit()` See `setSlowClientQueueLimit(int)`.
    `int` | `getSocketReceiveBuffer()` See `setSocketReceiveBuffer(int)`.
    `int` | `getSocketSendBuffer()` See `setSocketSendBuffer(int)`.
    `long` | `getSocketWriteTimeout()` See `setSocketWriteTimeout(long)`.
    `IgniteSpiContext` | `getSpiContext()` Gets SPI context.
    `int` | `getUnacknowledgedMessagesBufferSize()` See `setUnacknowledgedMessagesBufferSize(int)`.
    `protected void` | `injectResources(Ignite ignite)` Injects resources.
    `boolean` | `isDirectBuffer()` Gets flag that indicates whether direct or heap allocated buffer is used.
    `boolean` | `isDirectSendBuffer()` Gets flag defining whether direct send buffer should be used.
    `boolean` | `isFilterReachableAddresses()` Gets value for `FILTER_REACHABLE_ADDRESSES` socket option.
    `boolean` | `isTcpNoDelay()` Gets value for `TCP_NODELAY` socket option.
    `boolean` | `isUsePairedConnections()` See `setUsePairedConnections(boolean)`.
    `static short` | `makeMessageType(byte b0, byte b1)` Concatenates the two parameter bytes to form a message type value.
    `Collection<InetSocketAddress>` | `nodeAddresses(ClusterNode node, boolean filterReachableAddresses)`
    `protected void` | `notifyListener(UUID sndId, Message msg, IgniteRunnable msgC)`
    `void` | `onClientDisconnected(IgniteFuture<?> reconnectFut)` Client node disconnected callback.
    `void` | `onClientReconnected(boolean clusterRestarted)` Client node reconnected callback.
    `protected void` | `onContextDestroyed0()` Method to be called in the beginning of onContextDestroyed() method.
    `void` | `onContextInitialized0(IgniteSpiContext spiCtx)` Method to be called in the end of onContextInitialized method.
    `org.apache.ignite.internal.IgniteInternalFuture<Channel>` | `openChannel(ClusterNode remote, Message initMsg)`
    `protected SocketChannel` | `openSocketChannel()` Opens a socket channel.
    `protected void` | `processSessionCreationError(ClusterNode node, Collection<InetSocketAddress> addrs, IgniteCheckedException errs)` Process errors if TCP/IP `GridNioSession` creation to remote node hasn't been performed.
    `void` | `resetMetrics()` Resets metrics for this SPI instance.
    `void` | `sendMessage(ClusterNode node, Message msg)` Sends given message to destination node.
    `void` | `sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)` Sends given message to destination node.
    `TcpCommunicationSpi` | `setAckSendThreshold(int ackSndThreshold)` Sets number of received messages per connection to node after which acknowledgment message is sent.
    `TcpCommunicationSpi` | `setAddressResolver(AddressResolver addrRslvr)` Sets address resolver.
    `void` | `setConnectionRequestor(org.apache.ignite.spi.communication.tcp.internal.ConnectionRequestor connectionRequestor)`
    `TcpCommunicationSpi` | `setConnectionsPerNode(int maxConnectionsPerNode)` Sets number of connections to each remote node. if `isUsePairedConnections()` is `true` then number of connections is doubled and half is used for incoming and half for outgoing messages.
    `TcpCommunicationSpi` | `setConnectTimeout(long connTimeout)` Sets connect timeout used when establishing connection with remote nodes.
    `TcpCommunicationSpi` | `setDirectBuffer(boolean directBuf)` Sets flag to allocate direct or heap buffer in SPI.
    `TcpCommunicationSpi` | `setDirectSendBuffer(boolean directSndBuf)` Sets whether to use direct buffer for sending.
    `TcpCommunicationSpi` | `setFilterReachableAddresses(boolean filterReachableAddresses)` Setting this option to `true` enables filter for reachable addresses on creating tcp client.
    `TcpCommunicationSpi` | `setForceClientToServerConnections(boolean forceClientToSrvConnections)` Applicable for clients only.
    `TcpCommunicationSpi` | `setIdleConnectionTimeout(long idleConnTimeout)` Sets maximum idle connection timeout upon which a connection to client will be closed.
    `void` | `setListener(CommunicationListener<Message> lsnr)` Set communication listener.
    `TcpCommunicationSpi` | `setLocalAddress(String locAddr)` Sets local host address for socket binding.
    `TcpCommunicationSpi` | `setLocalPort(int locPort)` Sets local port for socket binding.
    `TcpCommunicationSpi` | `setLocalPortRange(int locPortRange)` Sets local port range for local host ports (value must greater than or equal to `0`).
    `TcpCommunicationSpi` | `setMaxConnectTimeout(long maxConnTimeout)` Sets maximum connect timeout.
    `TcpCommunicationSpi` | `setMessageQueueLimit(int msgQueueLimit)` Sets message queue limit for incoming and outgoing messages.
    `TcpCommunicationSpi` | `setName(String name)` Sets SPI name.
    `TcpCommunicationSpi` | `setReconnectCount(int reconCnt)` Sets maximum number of reconnect attempts used when establishing connection with remote nodes.
    `TcpCommunicationSpi` | `setSelectorsCount(int selectorsCnt)` Sets the count of selectors te be used in TCP server.
    `TcpCommunicationSpi` | `setSelectorSpins(long selectorSpins)` Defines how many non-blocking `selector.selectNow()` should be made before falling into `selector.select(long)` in NIO server.
    `TcpCommunicationSpi` | `setSharedMemoryPort(int shmemPort)` Sets local port to accept shared memory connections.
    `TcpCommunicationSpi` | `setSlowClientQueueLimit(int slowClientQueueLimit)` Sets slow client queue limit.
    `TcpCommunicationSpi` | `setSocketReceiveBuffer(int sockRcvBuf)` Sets receive buffer size for sockets created or accepted by this SPI.
    `TcpCommunicationSpi` | `setSocketSendBuffer(int sockSndBuf)` Sets send buffer size for sockets created or accepted by this SPI.
    `TcpCommunicationSpi` | `setSocketWriteTimeout(long sockWriteTimeout)` Sets socket write timeout for TCP connection.
    `TcpCommunicationSpi` | `setTcpNoDelay(boolean tcpNoDelay)` Sets value for `TCP_NODELAY` socket option.
    `TcpCommunicationSpi` | `setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize)` Sets maximum number of stored unacknowledged messages per connection to node.
    `TcpCommunicationSpi` | `setUsePairedConnections(boolean usePairedConnections)` Set this to `true` if `TcpCommunicationSpi` should maintain connection for outgoing and incoming messages separately.
    `void` | `simulateNodeFailure()` Stops service threads to simulate node failure.
    `void` | `spiStart(String igniteInstanceName)` This method is called to start SPI.
    `void` | `spiStop()` This method is called to stop SPI.
    `String` | `toString()`
    `static void` | `writeMessageType(ByteBuffer buf, short type)` Write message type to byte buffer.

    - ### Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `addTimeoutObject, assertParameter, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, ignite, initFailureDetectionTimeout, injectables, isNodeStopping, onBeforeStart, onContextDestroyed, onContextInitialized, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean`

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

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

    - ### Methods inherited from interface org.apache.ignite.spi.IgniteSpi

      `getName, onContextDestroyed, onContextInitialized`

- - ### Field Detail

    - #### OUT_OF_RESOURCES_TCP_MSG

          public static final String OUT_OF_RESOURCES_TCP_MSG

      IPC error message.
      See Also:
        Constant Field Values

    - #### ATTR_ADDRS

          public static final String ATTR_ADDRS

      Node attribute that is mapped to node IP addresses (value is `comm.tcp.addrs`).
      See Also:
        Constant Field Values

    - #### ATTR_HOST_NAMES

          public static final String ATTR_HOST_NAMES

      Node attribute that is mapped to node host names (value is `comm.tcp.host.names`).
      See Also:
        Constant Field Values

    - #### ATTR_PORT

          public static final String ATTR_PORT

      Node attribute that is mapped to node port number (value is `comm.tcp.port`).
      See Also:
        Constant Field Values

    - #### ATTR_SHMEM_PORT

          public static final String ATTR_SHMEM_PORT

      Node attribute that is mapped to node port number (value is `comm.shmem.tcp.port`).
      See Also:
        Constant Field Values

    - #### ATTR_EXT_ADDRS

          public static final String ATTR_EXT_ADDRS

      Node attribute that is mapped to node's external addresses (value is `comm.tcp.ext-addrs`).
      See Also:
        Constant Field Values

    - #### ATTR_PAIRED_CONN

          public static final String ATTR_PAIRED_CONN

      See Also:
        Constant Field Values

    - #### ATTR_FORCE_CLIENT_SERVER_CONNECTIONS

          public static final String ATTR_FORCE_CLIENT_SERVER_CONNECTIONS

      See Also:
        Constant Field Values

    - #### DFLT_PORT

          public static final int DFLT_PORT

      Default port which node sets listener to (value is `47100`).
      See Also:
        Constant Field Values

    - #### DFLT_SHMEM_PORT

          public static final int DFLT_SHMEM_PORT

      Default port which node sets listener for shared memory connections (value is `48100`).
      See Also:
        Constant Field Values

    - #### DFLT_IDLE_CONN_TIMEOUT

          public static final long DFLT_IDLE_CONN_TIMEOUT

      Default idle connection timeout (value is `10`min).
      See Also:
        Constant Field Values

    - #### DFLT_SOCK_BUF_SIZE

          public static final int DFLT_SOCK_BUF_SIZE

      Default socket send and receive buffer size.
      See Also:
        Constant Field Values

    - #### DFLT_CONN_TIMEOUT

          public static final long DFLT_CONN_TIMEOUT

      Default connection timeout (value is `5000`ms).
      See Also:
        Constant Field Values

    - #### DFLT_MAX_CONN_TIMEOUT

          public static final long DFLT_MAX_CONN_TIMEOUT

      Default Maximum connection timeout (value is `600,000`ms).
      See Also:
        Constant Field Values

    - #### DFLT_RECONNECT_CNT

          public static final int DFLT_RECONNECT_CNT

      Default reconnect attempts count (value is `10`).
      See Also:
        Constant Field Values

    - #### DFLT_MSG_QUEUE_LIMIT

          public static final int DFLT_MSG_QUEUE_LIMIT

      Default message queue limit per connection (for incoming and outgoing .
      See Also:
        Constant Field Values

    - #### DFLT_SELECTORS_CNT

          public static final int DFLT_SELECTORS_CNT

      Default count of selectors for TCP server equals to `"Math.max(4, Runtime.getRuntime().availableProcessors() / 2)"`.

    - #### CONN_IDX_META

          public static final int CONN_IDX_META

      Connection index meta for session.

    - #### CONSISTENT_ID_META

          public static final int CONSISTENT_ID_META

      Node consistent id meta for session.

    - #### DFLT_PORT_RANGE

          public static final int DFLT_PORT_RANGE

      Default local port range (value is `100`). See `setLocalPortRange(int)` for details.
      See Also:
        Constant Field Values

    - #### DFLT_TCP_NODELAY

          public static final boolean DFLT_TCP_NODELAY

      Default value for `TCP_NODELAY` socket option (value is `true`).
      See Also:
        Constant Field Values

    - #### DFLT_FILTER_REACHABLE_ADDRESSES

          public static final boolean DFLT_FILTER_REACHABLE_ADDRESSES

      Default value for `FILTER_REACHABLE_ADDRESSES` socket option (value is `false`).
      See Also:
        Constant Field Values

    - #### DFLT_ACK_SND_THRESHOLD

          public static final int DFLT_ACK_SND_THRESHOLD

      Default received messages threshold for sending ack.
      See Also:
        Constant Field Values

    - #### DFLT_SOCK_WRITE_TIMEOUT

          public static final long DFLT_SOCK_WRITE_TIMEOUT

      Default socket write timeout.
      See Also:
        Constant Field Values

    - #### DFLT_CONN_PER_NODE

          public static final int DFLT_CONN_PER_NODE

      Default connections per node.
      See Also:
        Constant Field Values

    - #### MAX_CONN_PER_NODE

          public static final int MAX_CONN_PER_NODE

      Maximum `GridNioSession` connections per node.
      See Also:
        Constant Field Values

    - #### NODE_ID_MSG_TYPE

          public static final short NODE_ID_MSG_TYPE

      Node ID message type.
      See Also:
        Constant Field Values

    - #### RECOVERY_LAST_ID_MSG_TYPE

          public static final short RECOVERY_LAST_ID_MSG_TYPE

      Recovery last received ID message type.
      See Also:
        Constant Field Values

    - #### HANDSHAKE_MSG_TYPE

          public static final short HANDSHAKE_MSG_TYPE

      Handshake message type.
      See Also:
        Constant Field Values

    - #### HANDSHAKE_WAIT_MSG_TYPE

          public static final short HANDSHAKE_WAIT_MSG_TYPE

      Handshake wait message type.
      See Also:
        Constant Field Values

    - #### COMMUNICATION_METRICS_GROUP_NAME

          public static final String COMMUNICATION_METRICS_GROUP_NAME

      Communication metrics group name.

    - #### SENT_MESSAGES_METRIC_NAME

          public static final String SENT_MESSAGES_METRIC_NAME

      See Also:
        Constant Field Values

    - #### SENT_MESSAGES_METRIC_DESC

          public static final String SENT_MESSAGES_METRIC_DESC

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_METRIC_NAME

          public static final String RECEIVED_MESSAGES_METRIC_NAME

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_METRIC_DESC

          public static final String RECEIVED_MESSAGES_METRIC_DESC

      See Also:
        Constant Field Values

    - #### SENT_MESSAGES_BY_TYPE_METRIC_NAME

          public static final String SENT_MESSAGES_BY_TYPE_METRIC_NAME

      See Also:
        Constant Field Values

    - #### SENT_MESSAGES_BY_TYPE_METRIC_DESC

          public static final String SENT_MESSAGES_BY_TYPE_METRIC_DESC

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME

          public static final String RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC

          public static final String RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC

      See Also:
        Constant Field Values

    - #### SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME

          public static final String SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME

      See Also:
        Constant Field Values

    - #### SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC

          public static final String SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME

          public static final String RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME

      See Also:
        Constant Field Values

    - #### RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC

          public static final String RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC

      See Also:
        Constant Field Values

    - #### DISABLED_CLIENT_PORT

          public static final Integer DISABLED_CLIENT_PORT

      Client nodes might have port `0` if they have no server socket opened.

    - #### tracing

          protected org.apache.ignite.internal.processors.tracing.Tracing tracing

      Tracing.

  - ### Constructor Detail

    - #### TcpCommunicationSpi

          public TcpCommunicationSpi()

  - ### Method Detail

    - #### setAddressResolver

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setAddressResolver(AddressResolver addrRslvr)

      Sets address resolver.
      Parameters:
        `addrRslvr` - Address resolver.
      Returns:
        `this` for chaining.

    - #### getAddressResolver

          public AddressResolver getAddressResolver()

      See `setAddressResolver(AddressResolver)`.
      Returns:
        Address resolver.

    - #### injectResources

          @IgniteInstanceResource
          protected void injectResources(Ignite ignite)

      Injects resources.
      Overrides:
        `injectResources` in class `IgniteSpiAdapter`
      Parameters:
        `ignite` - Ignite.

    - #### setLocalAddress

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setLocalAddress(String locAddr)

      Sets local host address for socket binding. Note that one node could have additional addresses beside the loopback one. This configuration parameter is optional.
      Parameters:
        `locAddr` - IP address. Default value is any available local IP address.
      Returns:
        `this` for chaining.

    - #### getLocalAddress

          public String getLocalAddress()

      See `setLocalAddress(String)`.
      Returns:
        Grid node IP address.

    - #### setLocalPort

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setLocalPort(int locPort)

      Sets local port for socket binding.

      If not provided, default value is `DFLT_PORT`.

      Parameters:
        `locPort` - Port number.
      Returns:
        `this` for chaining.

    - #### getLocalPort

          public int getLocalPort()

      See `setLocalPort(int)`.
      Returns:
        Port number.

    - #### setLocalPortRange

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setLocalPortRange(int locPortRange)

      Sets local port range for local host ports (value must greater than or equal to `0`). If provided local port (see `setLocalPort(int)`} is occupied, implementation will try to increment the port number for as long as it is less than initial value plus this range.

      If port range value is `0`, then implementation will try bind only to the port provided by `setLocalPort(int)` method and fail if binding to this port did not succeed.

      Local port range is very useful during development when more than one grid nodes need to run on the same physical machine.

      If not provided, default value is `DFLT_PORT_RANGE`.

      Parameters:
        `locPortRange` - New local port range.
      Returns:
        `this` for chaining.

    - #### getLocalPortRange

          public int getLocalPortRange()

      See `setLocalPortRange(int)`.
      Returns:
        Local Port range.

    - #### isUsePairedConnections

          public boolean isUsePairedConnections()

      See `setUsePairedConnections(boolean)`.
      Returns:
        `true` to use paired connections and `false` otherwise.

    - #### setUsePairedConnections

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setUsePairedConnections(boolean usePairedConnections)

      Set this to `true` if `TcpCommunicationSpi` should maintain connection for outgoing and incoming messages separately. In this case total number of connections between local and each remote node is `getConnectionsPerNode()` * 2.

      Set this to `false` if each connection of `getConnectionsPerNode()` should be used for outgoing and incoming messages. In this case total number of connections between local and each remote node is `getConnectionsPerNode()`.

      Default is `false`.

      Parameters:
        `usePairedConnections` - `true` to use paired connections and `false` otherwise.
      Returns:
        `this` for chaining.
      See Also:
        `getConnectionsPerNode()`

    - #### setConnectionsPerNode

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setConnectionsPerNode(int maxConnectionsPerNode)

      Sets number of connections to each remote node. if `isUsePairedConnections()` is `true` then number of connections is doubled and half is used for incoming and half for outgoing messages.
      Parameters:
        `maxConnectionsPerNode` - Number of connections per node.
      Returns:
        `this` for chaining.
      See Also:
        `isUsePairedConnections()`

    - #### getConnectionsPerNode

          public int getConnectionsPerNode()

      See `setConnectionsPerNode(int)`.
      Returns:
        Number of connections per node.

    - #### setSharedMemoryPort

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSharedMemoryPort(int shmemPort)

      Sets local port to accept shared memory connections.

      If set to `-1` shared memory communication will be disabled.

      If not provided, default value is `DFLT_SHMEM_PORT`.

      Parameters:
        `shmemPort` - Port number.
      Returns:
        `this` for chaining.

    - #### getSharedMemoryPort

          public int getSharedMemoryPort()

      See `setSharedMemoryPort(int)`.
      Returns:
        Port number.

    - #### setIdleConnectionTimeout

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setIdleConnectionTimeout(long idleConnTimeout)

      Sets maximum idle connection timeout upon which a connection to client will be closed.

      If not provided, default value is `DFLT_IDLE_CONN_TIMEOUT`.

      Parameters:
        `idleConnTimeout` - Maximum idle connection time.
      Returns:
        `this` for chaining.

    - #### getIdleConnectionTimeout

          public long getIdleConnectionTimeout()

      See `setIdleConnectionTimeout(long)`.
      Returns:
        Maximum idle connection time.

    - #### getSocketWriteTimeout

          public long getSocketWriteTimeout()

      See `setSocketWriteTimeout(long)`.
      Returns:
        Socket write timeout for TCP connections.

    - #### setSocketWriteTimeout

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSocketWriteTimeout(long sockWriteTimeout)

      Sets socket write timeout for TCP connection. If message can not be written to socket within this time then connection is closed and reconnect is attempted.

      Default to `DFLT_SOCK_WRITE_TIMEOUT`.

      Parameters:
        `sockWriteTimeout` - Socket write timeout for TCP connection.
      Returns:
        `this` for chaining.

    - #### getAckSendThreshold

          public int getAckSendThreshold()

      See `setAckSendThreshold(int)`.
      Returns:
        Number of received messages after which acknowledgment is sent.

    - #### setAckSendThreshold

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setAckSendThreshold(int ackSndThreshold)

      Sets number of received messages per connection to node after which acknowledgment message is sent.

      Default to `DFLT_ACK_SND_THRESHOLD`.

      Parameters:
        `ackSndThreshold` - Number of received messages after which acknowledgment is sent.
      Returns:
        `this` for chaining.

    - #### getUnacknowledgedMessagesBufferSize

          public int getUnacknowledgedMessagesBufferSize()

      See `setUnacknowledgedMessagesBufferSize(int)`.
      Returns:
        Maximum number of unacknowledged messages.

    - #### setUnacknowledgedMessagesBufferSize

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize)

      Sets maximum number of stored unacknowledged messages per connection to node. If number of unacknowledged messages exceeds this number then connection to node is closed and reconnect is attempted.
      Parameters:
        `unackedMsgsBufSize` - Maximum number of unacknowledged messages.
      Returns:
        `this` for chaining.

    - #### setConnectTimeout

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setConnectTimeout(long connTimeout)

      Sets connect timeout used when establishing connection with remote nodes.

      `0` is interpreted as infinite timeout.

      If not provided, default value is `DFLT_CONN_TIMEOUT`.

      When this property is explicitly set `IgniteConfiguration.getFailureDetectionTimeout()` is ignored.

      Parameters:
        `connTimeout` - Connect timeout.
      Returns:
        `this` for chaining.

    - #### getConnectTimeout

          public long getConnectTimeout()

      See `setConnectTimeout(long)`.
      Returns:
        Connect timeout.

    - #### setMaxConnectTimeout

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setMaxConnectTimeout(long maxConnTimeout)

      Sets maximum connect timeout. If handshake is not established within connect timeout, then SPI tries to repeat handshake procedure with increased connect timeout. Connect timeout can grow till maximum timeout value, if maximum timeout value is reached then the handshake is considered as failed.

      `0` is interpreted as infinite timeout.

      If not provided, default value is `DFLT_MAX_CONN_TIMEOUT`.

      When this property is explicitly set `IgniteConfiguration.getFailureDetectionTimeout()` is ignored.

      Parameters:
        `maxConnTimeout` - Maximum connect timeout.
      Returns:
        `this` for chaining.

    - #### getMaxConnectTimeout

          public long getMaxConnectTimeout()

      Gets maximum connect timeout.
      Returns:
        Maximum connect timeout.

    - #### setReconnectCount

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setReconnectCount(int reconCnt)

      Sets maximum number of reconnect attempts used when establishing connection with remote nodes.

      If not provided, default value is `DFLT_RECONNECT_CNT`.

      When this property is explicitly set `IgniteConfiguration.getFailureDetectionTimeout()` is ignored.

      Parameters:
        `reconCnt` - Maximum number of reconnection attempts.
      Returns:
        `this` for chaining.

    - #### getReconnectCount

          public int getReconnectCount()

      Gets maximum number of reconnect attempts used when establishing connection with remote nodes.
      Returns:
        Reconnects count.

    - #### setDirectBuffer

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setDirectBuffer(boolean directBuf)

      Sets flag to allocate direct or heap buffer in SPI. If value is `true`, then SPI will use `ByteBuffer.allocateDirect(int)` call. Otherwise, SPI will use `ByteBuffer.allocate(int)` call.

      If not provided, default value is `true`.

      Parameters:
        `directBuf` - Flag indicates to allocate direct or heap buffer in SPI.
      Returns:
        `this` for chaining.

    - #### isDirectBuffer

          public boolean isDirectBuffer()

      Gets flag that indicates whether direct or heap allocated buffer is used.
      Returns:
        Flag that indicates whether direct or heap allocated buffer is used.

    - #### isDirectSendBuffer

          public boolean isDirectSendBuffer()

      Gets flag defining whether direct send buffer should be used.
      Returns:
        `True` if direct buffers should be used.

    - #### setDirectSendBuffer

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setDirectSendBuffer(boolean directSndBuf)

      Sets whether to use direct buffer for sending. If not provided default is `false`.
      Parameters:
        `directSndBuf` - `True` to use direct buffers for send.
      Returns:
        `this` for chaining.

    - #### setSelectorsCount

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSelectorsCount(int selectorsCnt)

      Sets the count of selectors te be used in TCP server.

      If not provided, default value is `DFLT_SELECTORS_CNT`.
      Parameters:
        `selectorsCnt` - Selectors count.
      Returns:
        `this` for chaining.

    - #### getSelectorsCount

          public int getSelectorsCount()

      See `setSelectorsCount(int)`.
      Returns:
        Count of selectors in TCP server.

    - #### getSelectorSpins

          public long getSelectorSpins()

      See `setSelectorSpins(long)`.
      Returns:
        Selector thread busy-loop iterations.

    - #### setSelectorSpins

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSelectorSpins(long selectorSpins)

      Defines how many non-blocking `selector.selectNow()` should be made before falling into `selector.select(long)` in NIO server. Long value. Default is `0`. Can be set to `Long.MAX_VALUE` so selector threads will never block.
      Parameters:
        `selectorSpins` - Selector thread busy-loop iterations.
      Returns:
        `this` for chaining.

    - #### setTcpNoDelay

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setTcpNoDelay(boolean tcpNoDelay)

      Sets value for `TCP_NODELAY` socket option. Each socket will be opened using provided value.

      Setting this option to `true` disables Nagle's algorithm for socket decreasing latency and delivery time for small messages.

      For systems that work under heavy network load it is advisable to set this value to `false`.

      If not provided, default value is `DFLT_TCP_NODELAY`.

      Parameters:
        `tcpNoDelay` - `True` to disable TCP delay.
      Returns:
        `this` for chaining.

    - #### isTcpNoDelay

          public boolean isTcpNoDelay()

      Gets value for `TCP_NODELAY` socket option.
      Returns:
        `True` if TCP delay is disabled.

    - #### isFilterReachableAddresses

          public boolean isFilterReachableAddresses()

      Gets value for `FILTER_REACHABLE_ADDRESSES` socket option.
      Returns:
        `True` if needed to filter reachable addresses.

    - #### setFilterReachableAddresses

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setFilterReachableAddresses(boolean filterReachableAddresses)

      Setting this option to `true` enables filter for reachable addresses on creating tcp client.

      Usually its advised to set this value to `false`.

      If not provided, default value is `DFLT_FILTER_REACHABLE_ADDRESSES`.

      Parameters:
        `filterReachableAddresses` - `True` to filter reachable addresses.
      Returns:
        `this` for chaining.

    - #### setSocketReceiveBuffer

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSocketReceiveBuffer(int sockRcvBuf)

      Sets receive buffer size for sockets created or accepted by this SPI.

      If not provided, default is `DFLT_SOCK_BUF_SIZE`.

      Parameters:
        `sockRcvBuf` - Socket receive buffer size.
      Returns:
        `this` for chaining.

    - #### getSocketReceiveBuffer

          public int getSocketReceiveBuffer()

      See `setSocketReceiveBuffer(int)`.
      Returns:
        Socket receive buffer size.

    - #### setSocketSendBuffer

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSocketSendBuffer(int sockSndBuf)

      Sets send buffer size for sockets created or accepted by this SPI.

      If not provided, default is `DFLT_SOCK_BUF_SIZE`.

      Parameters:
        `sockSndBuf` - Socket send buffer size.
      Returns:
        `this` for chaining.

    - #### getSocketSendBuffer

          public int getSocketSendBuffer()

      See `setSocketSendBuffer(int)`.
      Returns:
        Socket send buffer size.

    - #### setMessageQueueLimit

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setMessageQueueLimit(int msgQueueLimit)

      Sets message queue limit for incoming and outgoing messages.

      When set to positive number send queue is limited to the configured value. `0` disables the size limitations.

      If not provided, default is `DFLT_MSG_QUEUE_LIMIT`.

      Parameters:
        `msgQueueLimit` - Send queue size limit.
      Returns:
        `this` for chaining.

    - #### getMessageQueueLimit

          public int getMessageQueueLimit()

      Gets message queue limit for incoming and outgoing messages.
      Returns:
        Send queue size limit.

    - #### getSlowClientQueueLimit

          public int getSlowClientQueueLimit()

      See `setSlowClientQueueLimit(int)`.
      Returns:
        Slow client queue limit.

    - #### setSlowClientQueueLimit

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setSlowClientQueueLimit(int slowClientQueueLimit)

      Sets slow client queue limit.

      When set to a positive number, communication SPI will monitor clients outbound message queue sizes and will drop those clients whose queue exceeded this limit.

      This value should be set to less or equal value than `getMessageQueueLimit()` which controls message back-pressure for server nodes. The default value for this parameter is `0` which means `unlimited`.
      Parameters:
        `slowClientQueueLimit` - Slow client queue limit.
      Returns:
        `this` for chaining.

    - #### forceClientToServerConnections

          public boolean forceClientToServerConnections()

      Returns:
        Force client to server connections flag.
      See Also:
        `setForceClientToServerConnections(boolean)`

    - #### setForceClientToServerConnections

          @IgniteSpiConfiguration(optional=true)
          public TcpCommunicationSpi setForceClientToServerConnections(boolean forceClientToSrvConnections)

      Applicable for clients only. Sets PSI in the mode when server node cannot open TCP connection to the current node. Possile reasons for that may be specific network configurations or security rules. In this mode, when server needs the connection with client, it uses `DiscoverySpi` protocol to notify client about it. After that client opens the required connection from its side.

    - #### setListener

          public void setListener(CommunicationListener<Message> lsnr)

      Set communication listener.
      Specified by:
        `setListener` in interface `CommunicationSpi<Message>`
      Parameters:
        `lsnr` - Listener to set or `null` to unset the listener.

    - #### getListener

          public CommunicationListener getListener()

      Returns:
        Listener.

    - #### setConnectionRequestor

          public void setConnectionRequestor(org.apache.ignite.spi.communication.tcp.internal.ConnectionRequestor connectionRequestor)

    - #### getSentMessagesCount

          public int getSentMessagesCount()

      Gets sent messages count.
      Specified by:
        `getSentMessagesCount` in interface `CommunicationSpi<Message>`
      Returns:
        Sent messages count.

    - #### getSentBytesCount

          public long getSentBytesCount()

      Gets sent bytes count.
      Specified by:
        `getSentBytesCount` in interface `CommunicationSpi<Message>`
      Returns:
        Sent bytes count.

    - #### getReceivedMessagesCount

          public int getReceivedMessagesCount()

      Gets received messages count.
      Specified by:
        `getReceivedMessagesCount` in interface `CommunicationSpi<Message>`
      Returns:
        Received messages count.

    - #### getReceivedBytesCount

          public long getReceivedBytesCount()

      Gets received bytes count.
      Specified by:
        `getReceivedBytesCount` in interface `CommunicationSpi<Message>`
      Returns:
        Received bytes count.

    - #### getReceivedMessagesByType

          public Map<String,Long> getReceivedMessagesByType()

      Gets received messages counts (grouped by type).
      Returns:
        Map containing message types and respective counts.

    - #### getReceivedMessagesByNode

          public Map<UUID,Long> getReceivedMessagesByNode()

      Gets received messages counts (grouped by node).
      Returns:
        Map containing sender nodes and respective counts.

    - #### getSentMessagesByType

          public Map<String,Long> getSentMessagesByType()

      Gets sent messages counts (grouped by type).
      Returns:
        Map containing message types and respective counts.

    - #### getSentMessagesByNode

          public Map<UUID,Long> getSentMessagesByNode()

      Gets sent messages counts (grouped by node).
      Returns:
        Map containing receiver nodes and respective counts.

    - #### getOutboundMessagesQueueSize

          public int getOutboundMessagesQueueSize()

      Gets outbound messages queue size.
      Specified by:
        `getOutboundMessagesQueueSize` in interface `CommunicationSpi<Message>`
      Returns:
        Outbound messages queue size.

    - #### resetMetrics

          public void resetMetrics()

      Resets metrics for this SPI instance.
      Specified by:
        `resetMetrics` in interface `CommunicationSpi<Message>`

    - #### dumpNodeStatistics

          public org.apache.ignite.internal.IgniteInternalFuture<String> dumpNodeStatistics(UUID nodeId)

      Parameters:
        `nodeId` - Target node ID.
      Returns:
        Future.

    - #### dumpStats

          public void dumpStats()

      Dumps SPI per-connection stats to logs.

    - #### getNodeAttributes

          public Map<String,Object> getNodeAttributes()
                                               throws IgniteSpiException

      This method is called before SPI starts (before method `IgniteSpi.spiStart(String)` is called). It allows SPI implementation to add attributes to a local node. Kernal collects these attributes from all SPI implementations loaded up and then passes it to discovery SPI so that they can be exchanged with other nodes.
      Specified by:
        `getNodeAttributes` in interface `IgniteSpi`
      Overrides:
        `getNodeAttributes` in class `IgniteSpiAdapter`
      Returns:
        Map of local node attributes this SPI wants to add.
      Throws:
        `IgniteSpiException` - Throws in case of any error.

    - #### boundPort

          public int boundPort()

      Returns:
        Bound TCP server port.

    - #### spiStart

          public void spiStart(String igniteInstanceName)
                        throws IgniteSpiException

      This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.
      Specified by:
        `spiStart` in interface `IgniteSpi`
      Parameters:
        `igniteInstanceName` - Name of Ignite instance this SPI is being started for (`null` for default Ignite instance).
      Throws:
        `IgniteSpiException` - Throws in case of any error during SPI start.

    - #### onContextInitialized0

          public void onContextInitialized0(IgniteSpiContext spiCtx)
                                     throws IgniteSpiException

      Method to be called in the end of onContextInitialized method. }
      Overrides:
        `onContextInitialized0` in class `IgniteSpiAdapter`
      Parameters:
        `spiCtx` - SPI context.
      Throws:
        `IgniteSpiException` - In case of errors.

    - #### getSpiContext

          public IgniteSpiContext getSpiContext()

      Gets SPI context.
      Overrides:
        `getSpiContext` in class `IgniteSpiAdapter`
      Returns:
        SPI context.

    - #### spiStop

          public void spiStop()
                       throws IgniteSpiException

      This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

      Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

      Specified by:
        `spiStop` in interface `IgniteSpi`
      Throws:
        `IgniteSpiException` - Thrown in case of any error during SPI stop.

    - #### onContextDestroyed0

          protected void onContextDestroyed0()

      Method to be called in the beginning of onContextDestroyed() method.
      Overrides:
        `onContextDestroyed0` in class `IgniteSpiAdapter`

    - #### onClientDisconnected

          public void onClientDisconnected(IgniteFuture<?> reconnectFut)

      Client node disconnected callback.
      Specified by:
        `onClientDisconnected` in interface `IgniteSpi`
      Overrides:
        `onClientDisconnected` in class `IgniteSpiAdapter`
      Parameters:
        `reconnectFut` - Future that will be completed when client reconnected.

    - #### onClientReconnected

          public void onClientReconnected(boolean clusterRestarted)

      Client node reconnected callback.
      Specified by:
        `onClientReconnected` in interface `IgniteSpi`
      Overrides:
        `onClientReconnected` in class `IgniteSpiAdapter`
      Parameters:
        `clusterRestarted` - `True` if all cluster nodes restarted while client was disconnected.

    - #### checkConfigurationConsistency0

          protected void checkConfigurationConsistency0(IgniteSpiContext spiCtx,
                                                        ClusterNode node,
                                                        boolean starting)
                                                 throws IgniteSpiException

      Method which is called in the end of checkConfigurationConsistency() method. May be overriden in SPIs.
      Overrides:
        `checkConfigurationConsistency0` in class `IgniteSpiAdapter`
      Parameters:
        `spiCtx` - SPI context.
        `node` - Remote node.
        `starting` - If this node is starting or not.
      Throws:
        `IgniteSpiException` - in case of errors.

    - #### sendMessage

          public void sendMessage(ClusterNode node,
                                  Message msg)
                           throws IgniteSpiException

      Sends given message to destination node. Note that characteristics of the exchange such as durability, guaranteed delivery or error notification is dependant on SPI implementation.
      Specified by:
        `sendMessage` in interface `CommunicationSpi<Message>`
      Parameters:
        `node` - Destination node.
        `msg` - Message to send.
      Throws:
        `IgniteSpiException` - Thrown in case of any error during sending the message. Note that this is not guaranteed that failed communication will result in thrown exception as this is dependant on SPI implementation.

    - #### checkConnection

          public IgniteFuture<BitSet> checkConnection(List<ClusterNode> nodes)

      Parameters:
        `nodes` - Nodes to check connection with.
      Returns:
        Result future (each bit in result BitSet contains connection status to corresponding node).

    - #### sendMessage

          public void sendMessage(ClusterNode node,
                                  Message msg,
                                  IgniteInClosure<IgniteException> ackC)
                           throws IgniteSpiException

      Sends given message to destination node. Note that characteristics of the exchange such as durability, guaranteed delivery or error notification is dependant on SPI implementation.
      Parameters:
        `node` - Destination node.
        `msg` - Message to send.
        `ackC` - Ack closure.
      Throws:
        `IgniteSpiException` - Thrown in case of any error during sending the message. Note that this is not guaranteed that failed communication will result in thrown exception as this is dependant on SPI implementation.

    - #### nodeAddresses

          public Collection<InetSocketAddress> nodeAddresses(ClusterNode node,
                                                             boolean filterReachableAddresses)
                                                      throws IgniteCheckedException

      Parameters:
        `node` - Node.
        `filterReachableAddresses` - Filter addresses flag.
      Returns:
        Node addresses.
      Throws:
        `IgniteCheckedException` - If node does not have addresses.

    - #### createTcpClient

          protected org.apache.ignite.internal.util.nio.GridCommunicationClient createTcpClient(ClusterNode node,
                                                                                                int connIdx)
                                                                                         throws IgniteCheckedException

      Establish TCP connection to remote node and returns client.
      Parameters:
        `node` - Remote node.
        `connIdx` - Connection index.
      Returns:
        Client.
      Throws:
        `IgniteCheckedException` - If failed.

    - #### openSocketChannel

          protected SocketChannel openSocketChannel()
                                             throws IOException

      Opens a socket channel.
      Returns:
        A new socket channel.
      Throws:
        `IOException` - If an I/O error occurs.

    - #### processSessionCreationError

          protected void processSessionCreationError(ClusterNode node,
                                                     Collection<InetSocketAddress> addrs,
                                                     IgniteCheckedException errs)
                                              throws IgniteCheckedException

      Process errors if TCP/IP `GridNioSession` creation to remote node hasn't been performed.
      Parameters:
        `node` - Remote node.
        `addrs` - Remote node addresses.
        `errs` - TCP client creation errors.
      Throws:
        `IgniteCheckedException` - If failed.

    - #### notifyListener

          protected void notifyListener(UUID sndId,
                                        Message msg,
                                        IgniteRunnable msgC)

      Parameters:
        `sndId` - Sender ID.
        `msg` - Communication message.
        `msgC` - Closure to call when message processing finished.

    - #### simulateNodeFailure

          @TestOnly
          public void simulateNodeFailure()

      Stops service threads to simulate node failure. FOR TEST PURPOSES ONLY!!!

    - #### setName

          public TcpCommunicationSpi setName(String name)

      Sets SPI name.
      Overrides:
        `setName` in class `IgniteSpiAdapter`
      Parameters:
        `name` - SPI name.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### writeMessageType

          public static void writeMessageType(ByteBuffer buf,
                                              short type)

      Write message type to byte buffer.
      Parameters:
        `buf` - Byte buffer.
        `type` - Message type.

    - #### makeMessageType

          public static short makeMessageType(byte b0,
                                              byte b1)

      Concatenates the two parameter bytes to form a message type value.
      Parameters:
        `b0` - The first byte.
        `b1` - The second byte.

    - #### openChannel

          public org.apache.ignite.internal.IgniteInternalFuture<Channel> openChannel(ClusterNode remote,
                                                                                      Message initMsg)
                                                                               throws IgniteSpiException

      Parameters:
        `remote` - Destination cluster node to communicate with.
        `initMsg` - Configuration channel attributes wrapped into the message.
      Returns:
        The future, which will be finished on channel ready.
      Throws:
        `IgniteSpiException` - If fails.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020