public final class NonBlockingSocketReader extends AbstractHandler implements SocketReader
SocketReader tailored for non blocking IO.
When the NonBlockingIOThread receives a read event from the Selector, then the
handle() is called to read out the data from the socket into a bytebuffer and hand it over to the
ReadHandler to get processed.connection, connectionManager, ioService, ioThread, logger, selectionKey, socketChannel| Constructor and Description |
|---|
NonBlockingSocketReader(TcpIpConnection connection,
NonBlockingIOThread ioThread,
MetricsRegistry metricsRegistry) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys this SocketReader.
|
long |
getEventCount()
Get number of events recorded by the current handler.
|
long |
getLastReadTimeMillis()
Returns the last
Clock.currentTimeMillis() a read of the socket was done. |
Counter |
getNormalFramesReadCounter()
Gets the Counter that counts the number of normal packets that have been read.
|
Counter |
getPriorityFramesReadCounter()
Gets the Counter that counts the number of priority packets that have been read.
|
void |
handle()
Called when there are bytes available for reading, or space available to write.
|
void |
init()
Initializes this SocketReader.
|
void |
requestMigration(NonBlockingIOThread newOwner)
Migrates this handler to a new NonBlockingIOThread.
|
String |
toString() |
getOwner, getSelectionKey, onFailurepublic NonBlockingSocketReader(TcpIpConnection connection, NonBlockingIOThread ioThread, MetricsRegistry metricsRegistry)
public Counter getNormalFramesReadCounter()
SocketReadergetNormalFramesReadCounter in interface SocketReaderpublic Counter getPriorityFramesReadCounter()
SocketReadergetPriorityFramesReadCounter in interface SocketReaderpublic long getLastReadTimeMillis()
SocketReaderClock.currentTimeMillis() a read of the socket was done.getLastReadTimeMillis in interface SocketReaderpublic long getEventCount()
MigratableHandlerNonBlockingIOThreadgetEventCount in interface MigratableHandlerpublic void init()
SocketReaderinit in interface SocketReaderpublic void requestMigration(NonBlockingIOThread newOwner)
requestMigration in interface MigratableHandlernewOwner - target NonBlockingIOThread this handler migrates topublic void handle()
throws Exception
SelectionHandlerhandle in interface SelectionHandlerExceptionpublic void destroy()
SocketReaderdestroy in interface SocketReaderCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.