public final class NonBlockingSocketWriter extends AbstractHandler implements Runnable, SocketWriter
TcpIpConnection
.connection, connectionManager, ioService, ioThread, logger, selectionKey, selector, socketChannel
Modifier and Type | Method and Description |
---|---|
long |
bytesPending() |
long |
getEventCount()
Get number of events recorded by the current handler.
|
long |
getLastWriteTimeMillis()
Returns the last
Clock.currentTimeMillis() that a write to the socket completed. |
WriteHandler |
getWriteHandler()
Gets the
WriteHandler that belongs to this SocketWriter. |
void |
handle()
Called when there are bytes available for reading, or space available to write.
|
void |
offer(OutboundFrame frame)
Offers a Frame to be written to the socket.
|
long |
priorityBytesPending() |
void |
requestMigration(NonBlockingIOThread newOwner)
Requests the MigratableHandler to move to the new NonBlockingIOThread.
|
void |
run() |
void |
setProtocol(String protocol)
Sets the protocol this SocketWriter should use.
|
void |
shutdown()
Shuts down this SocketWriter.
|
void |
start()
Starts this SocketWriter.
|
String |
toString() |
int |
totalFramesPending()
Returns the total number of packets (urgent and non normal priority) pending to be written to the socket.
|
getOwner, getSelectionKey, onFailure
public int totalFramesPending()
SocketWriter
totalFramesPending
in interface SocketWriter
public long getLastWriteTimeMillis()
SocketWriter
Clock.currentTimeMillis()
that a write to the socket completed.
Writing to the socket doesn't mean that data has been send or received; it means that data was written to the
SocketChannel. It could very well be that this data is stuck somewhere in an io-buffer.getLastWriteTimeMillis
in interface SocketWriter
public WriteHandler getWriteHandler()
SocketWriter
WriteHandler
that belongs to this SocketWriter.
This method exists for the TextReadHandler
, but probably should be deleted.getWriteHandler
in interface SocketWriter
public long bytesPending()
public long priorityBytesPending()
public void setProtocol(String protocol)
SocketWriter
Protocols
setProtocol
in interface SocketWriter
protocol
- the protocolpublic void offer(OutboundFrame frame)
SocketWriter
offer
in interface SocketWriter
frame
- the Frame to write.public long getEventCount()
MigratableHandler
NonBlockingIOThread
getEventCount
in interface MigratableHandler
public void handle() throws Exception
SelectionHandler
handle
in interface SelectionHandler
Exception
public void shutdown()
SocketWriter
shutdown
in interface SocketWriter
SocketWriter.start()
public void start()
SocketWriter
start
in interface SocketWriter
SocketWriter.shutdown()
public void requestMigration(NonBlockingIOThread newOwner)
MigratableHandler
IOBalancer
.
Call is ignored when handler is moving to the same NonBlockingIOThread.requestMigration
in interface MigratableHandler
newOwner
- the NonBlockingIOThread that is going to own this MigratableHandlerCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.