public class SpinningSocketWriter extends AbstractHandler implements SocketWriter
Modifier and Type | Field and Description |
---|---|
Queue<OutboundFrame> |
urgentWriteQueue |
Queue<OutboundFrame> |
writeQueue |
connection, connectionManager, ioService
Constructor and Description |
---|
SpinningSocketWriter(TcpIpConnection connection,
MetricsRegistry metricsRegistry,
ILogger logger) |
Modifier and Type | Method and Description |
---|---|
long |
bytesPending() |
void |
close()
Closes this SocketWriter.
|
long |
getLastWriteTimeMillis()
Returns the last
Clock.currentTimeMillis() that a write to the socket completed. |
WriteHandler |
getWriteHandler()
Gets the
WriteHandler that belongs to this SocketWriter. |
long |
priorityBytesPending() |
void |
setProtocol(String protocol)
Sets the protocol this SocketWriter should use.
|
int |
totalFramesPending()
Returns the total number of packets (urgent and non normal priority) pending to be written to the socket.
|
void |
write() |
void |
write(OutboundFrame frame)
Offers a Frame to be written to the socket.
|
onFailure
public final Queue<OutboundFrame> writeQueue
public final Queue<OutboundFrame> urgentWriteQueue
public SpinningSocketWriter(TcpIpConnection connection, MetricsRegistry metricsRegistry, ILogger logger)
public void write(OutboundFrame frame)
SocketWriter
write
in interface SocketWriter
frame
- the Frame to write.public long bytesPending()
public long priorityBytesPending()
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 void setProtocol(String protocol)
SocketWriter
Protocols
setProtocol
in interface SocketWriter
protocol
- the protocolpublic void close()
SocketWriter
TcpIpConnection.close(String, Throwable)
method.close
in interface SocketWriter
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.