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 Description GridTcpNioCommunicationClient(int connIdx, GridNioSession ses, IgniteLogger log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasync()booleanclose()voiddoHandshake(IgniteInClosure2X<InputStream,OutputStream> handshakeC)Executes the given handshake closure on opened client passing underlying IO streams.voidforceClose()Forces client close.longgetIdleTime()Gets idle time of this client.voidsendMessage(byte[] data, int len)booleansendMessage(@Nullable UUID nodeId, Message msg, IgniteInClosure<IgniteException> c)voidsendMessage(ByteBuffer data)GridNioSessionsession()StringtoString()-
Methods inherited from class org.apache.ignite.internal.util.nio.GridAbstractCommunicationClient
closed, connectionIndex, markUsed, release, reserve
-
-
-
-
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:
closein interfaceGridCommunicationClient- Overrides:
closein classGridAbstractCommunicationClient- Returns:
Trueif client has been closed by this call,falseif failed to close client (due to concurrent reservation or concurrent close).
-
forceClose
public void forceClose()
Forces client close.- Specified by:
forceClosein interfaceGridCommunicationClient- Overrides:
forceClosein classGridAbstractCommunicationClient
-
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:
Trueif should try to resend message.- Throws:
IgniteCheckedException- If failed.
-
async
public boolean async()
- Specified by:
asyncin interfaceGridCommunicationClient- Overrides:
asyncin classGridAbstractCommunicationClient- Returns:
Trueif send is asynchronous.
-
getIdleTime
public long getIdleTime()
Gets idle time of this client.- Specified by:
getIdleTimein interfaceGridCommunicationClient- Overrides:
getIdleTimein classGridAbstractCommunicationClient- Returns:
- Idle time of this client.
-
toString
public String toString()
- Overrides:
toStringin classGridAbstractCommunicationClient
-
-