public class ClientReadHandler extends Object implements ReadHandler, ClientMessageReadHandler.MessageHandler
ReadHandler for the new-client. It passes the ByteBuffer to the ClientMessageReadHandler. For each
constructed ClientMessage, the handleMessage(ClientMessage) is called; which passes the message
to the IOService.handleClientMessage(ClientMessage, Connection).
Probably the design can be simplified if the IOService would expose a method getMessageHandler; so we
don't need to let the ClientReadHandler act like the MessageHandler, but directly send to the right
data-structure.ClientWriteHandler| Constructor and Description |
|---|
ClientReadHandler(SwCounter messageCounter,
Connection connection,
IOService ioService) |
| Modifier and Type | Method and Description |
|---|---|
void |
handleMessage(ClientMessage message)
Received message to be processed
|
void |
onRead(ByteBuffer src)
A callback to indicate that data is available in the ByteBuffer to be processed.
|
public ClientReadHandler(SwCounter messageCounter, Connection connection, IOService ioService) throws IOException
IOExceptionpublic void onRead(ByteBuffer src) throws Exception
ReadHandleronRead in interface ReadHandlersrc - the ByteBuffer containing the data to read. The ByteBuffer is already in reading mode and when completed,
should not be converted to write-mode using clear/compact. That is a task of the SocketReader.Exception - if something fails while reading data from the ByteBuffer or processing the data
(e.g. when a Packet fails to get processed). When an exception is thrown, the TcpIpConnection
is closed. There is no point continuing with a potentially corrupted stream.public void handleMessage(ClientMessage message)
ClientMessageReadHandler.MessageHandlerhandleMessage in interface ClientMessageReadHandler.MessageHandlermessage - the ClientMessageCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.