org.apache.ignite.internal.util.nio

## Class GridTcpNioCommunicationClient

- java.lang.Object
- - org.apache.ignite.internal.util.nio.GridAbstractCommunicationClient
  - - org.apache.ignite.internal.util.nio.GridTcpNioCommunicationClient

All Implemented Interfaces:
  GridCommunicationClient

    public class GridTcpNioCommunicationClient
    extends GridAbstractCommunicationClient

Grid client for NIO server.

### Constructor Summary

Constructors
Constructor and Description
`GridTcpNioCommunicationClient(int connIdx, GridNioSession ses, IgniteLogger log)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `async()`
`boolean` `close()`
`void` `doHandshake(IgniteInClosure2X<InputStream,OutputStream> handshakeC)` Executes the given handshake closure on opened client passing underlying IO streams.
`void` `forceClose()` Forces client close.
`long` `getIdleTime()` Gets idle time of this client.
`void` `sendMessage(byte[] data, int len)`
`void` `sendMessage(ByteBuffer data)`
`boolean` `sendMessage(@Nullable UUID nodeId, Message msg, IgniteInClosure<IgniteException> c)`
`GridNioSession` `session()`
`String` `toString()`

### Methods inherited from class org.apache.ignite.internal.util.nio.GridAbstractCommunicationClient

`closed, connectionIndex, markUsed, release, reserve`

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

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

### Constructor Detail

#### GridTcpNioCommunicationClient

    public GridTcpNioCommunicationClient(int connIdx,
                                         GridNioSession ses,
                                         IgniteLogger log)

Parameters:
  `connIdx` - Connection index.
  `ses` - Session.
  `log` - Logger.

### Method Detail

#### session

    public GridNioSession session()

Returns:
  Gets underlying session.

#### doHandshake

    public void doHandshake(IgniteInClosure2X<InputStream,OutputStream> handshakeC)

Executes the given handshake closure on opened client passing underlying IO streams. This method pulled to client interface a handshake is only operation requiring access to both output and input streams.

Parameters:
  `handshakeC` - Handshake.

#### close

    public boolean close()

Specified by:
  `close` in interface `GridCommunicationClient`
Overrides:
  `close` in class `GridAbstractCommunicationClient`
Returns:
  `True` if client has been closed by this call, `false` if failed to close client (due to concurrent reservation or concurrent close).

#### forceClose

    public void forceClose()

Forces client close.

Specified by:
  `forceClose` in interface `GridCommunicationClient`
Overrides:
  `forceClose` in class `GridAbstractCommunicationClient`

#### sendMessage

    public void sendMessage(byte[] data,
                            int len)
                     throws IgniteCheckedException

Parameters:
  `data` - Data to send.
  `len` - Length.
Throws:
  `IgniteCheckedException` - If failed.

#### sendMessage

    public void sendMessage(ByteBuffer data)
                     throws IgniteCheckedException

Parameters:
  `data` - Data to send.
Throws:
  `IgniteCheckedException` - If failed.

#### sendMessage

    public boolean sendMessage(@Nullable
                               @Nullable UUID nodeId,
                               Message msg,
                               IgniteInClosure<IgniteException> c)
                        throws IgniteCheckedException

Parameters:
  `nodeId` - Remote node ID. Provided only for sync clients.
  `msg` - Message to send.
  `c` - Ack closure.
Returns:
  `True` if should try to resend message.
Throws:
  `IgniteCheckedException` - If failed.

#### async

    public boolean async()

Specified by:
  `async` in interface `GridCommunicationClient`
Overrides:
  `async` in class `GridAbstractCommunicationClient`
Returns:
  `True` if send is asynchronous.

#### getIdleTime

    public long getIdleTime()

Gets idle time of this client.

Specified by:
  `getIdleTime` in interface `GridCommunicationClient`
Overrides:
  `getIdleTime` in class `GridAbstractCommunicationClient`
Returns:
  Idle time of this client.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridAbstractCommunicationClient`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020