public class NewClientReadHandler extends Object implements ReadHandler, ClientMessageBuilder.MessageHandler
ReadHandler
for the new-client. It passes the ByteBuffer to the ClientMessageBuilder. 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 NewClientReadHandler act like the MessageHandler, but directly send to the right
data-structure.NewClientWriteHandler
Constructor and Description |
---|
NewClientReadHandler(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 NewClientReadHandler(Connection connection, IOService ioService) throws IOException
IOException
public void onRead(ByteBuffer src) throws Exception
ReadHandler
onRead
in interface ReadHandler
src
- 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)
ClientMessageBuilder.MessageHandler
handleMessage
in interface ClientMessageBuilder.MessageHandler
message
- the ClientMessageCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.