org.apache.ignite.internal.util.nio

## Class GridShmemCommunicationClient

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

All Implemented Interfaces:
  GridCommunicationClient

    public class GridShmemCommunicationClient
    extends GridAbstractCommunicationClient

### Field Summary

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

`metricsLsnr`

### Constructor Summary

Constructors
Constructor and Description
`GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout, IgniteLogger log, MessageFormatter formatter)`

### Method Summary

Methods
`boolean` `close()`
`void` `doHandshake(IgniteInClosure2X<InputStream,OutputStream> handshakeC)` Executes the given handshake closure on opened client passing underlying IO streams.
`void` `flushIfNeeded(long timeout)`
`void` `forceClose()` Forces client close.
`void` `sendMessage(byte[] data, int len)`
`void` `sendMessage(ByteBuffer data)`
`boolean` `sendMessage(UUID nodeId, MessageAdapter msg)`
`String` `toString()`

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

`async, closed, getIdleTime, markUsed, release, reserve, reserved`

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

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

### Constructor Detail

#### GridShmemCommunicationClient

    public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr,
                                int port,
                                long connTimeout,
                                IgniteLogger log,
                                MessageFormatter formatter)
                                 throws IgniteCheckedException

Parameters:
  `metricsLsnr` - Metrics listener.
  `port` - Shared memory IPC server port.
  `connTimeout` - Connection timeout.
  `log` - Logger.
  `formatter` - Message formatter.
Throws:
  `IgniteCheckedException` - If failed.

### Method Detail

#### doHandshake

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

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.
Throws:
  `IgniteCheckedException` - If handshake failed.

#### 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 boolean sendMessage(@Nullable
                      UUID nodeId,
                      MessageAdapter msg)
                        throws IgniteCheckedException

Parameters:
  `nodeId` - Node ID (provided only if versions of local and remote nodes are different).
  `msg` - Message to send.
Returns:
  `True` if should try to resend message.
Throws:
  `IgniteCheckedException` - If failed.

#### sendMessage

    public void sendMessage(ByteBuffer data)
                     throws IgniteCheckedException

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

#### flushIfNeeded

    public void flushIfNeeded(long timeout)
                       throws IOException

Parameters:
  `timeout` - Timeout.
Throws:
  `IOException` - If failed.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridAbstractCommunicationClient`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015