public class NioChannel extends AbstractChannel
Channel
implementation tailored
for non blocking IO using Selector
in combination
with a non blocking SocketChannel
.socketChannel
Constructor and Description |
---|
NioChannel(SocketChannel socketChannel,
boolean clientMode) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes whatever needs to be written.
|
NioInboundPipeline |
inboundPipeline() |
void |
init(NioInboundPipeline inboundPipeline,
NioOutboundPipeline outboundPipeline) |
long |
lastReadTimeMillis()
Returns the last
Clock.currentTimeMillis() a read
of the socket was done. |
long |
lastWriteTimeMillis()
Returns the last
Clock.currentTimeMillis() that a
write to the socket completed. |
protected void |
onClose()
Template method that is called when the socket channel closed.
|
NioOutboundPipeline |
outboundPipeline() |
String |
toString() |
boolean |
write(OutboundFrame frame)
Queues the
OutboundFrame to be written at some point in the future. |
addCloseListener, attributeMap, close, closeInbound, closeOutbound, isClientMode, isClosed, localSocketAddress, read, remoteSocketAddress, socket, socketChannel, write
public NioChannel(SocketChannel socketChannel, boolean clientMode)
public void init(NioInboundPipeline inboundPipeline, NioOutboundPipeline outboundPipeline)
public NioOutboundPipeline outboundPipeline()
public NioInboundPipeline inboundPipeline()
public boolean write(OutboundFrame frame)
Channel
OutboundFrame
to be written at some point in the future.
No guarantee is made that the frame actually is going to be written or received.
This method is thread-safe.frame
- the frame to write.public long lastReadTimeMillis()
Channel
Clock.currentTimeMillis()
a read
of the socket was done.
This method is thread-safe.public long lastWriteTimeMillis()
Channel
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.
This method is thread-safe.public void flush()
Channel
Channel.write(OutboundFrame)
write the content; but in case of protocol
and TLS handshaking, such triggers are needed.protected void onClose()
AbstractChannel
socketChannel
is closed.
It will be called only once.onClose
in class AbstractChannel
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.