public final class NioChannel extends AbstractChannel
Channel
implementation tailored
for non blocking IO using Selector
in combination
with a non blocking SocketChannel
.logger, socketChannel
Constructor and Description |
---|
NioChannel(SocketChannel socketChannel,
boolean clientMode,
ChannelInitializer channelInitializer,
MetricsRegistry metricsRegistry,
Executor closeListenerExecutor) |
Modifier and Type | Method and Description |
---|---|
long |
bytesRead()
Returns current count of bytes read from the Channel.
|
long |
bytesWritten()
Returns current count of bytes written into the Channel.
|
protected void |
close0()
Template method that is called when the Channel is closed.
|
NioInboundPipeline |
inboundPipeline()
Returns the
InboundPipeline that belongs to this Channel. |
void |
init(NioInboundPipeline inboundPipeline,
NioOutboundPipeline outboundPipeline) |
long |
lastReadTimeMillis()
Returns the last time epoch time in ms a read of the socket was done.
|
long |
lastWriteTimeMillis()
Returns the last time epoch time in ms a write to the socket was done.
|
protected void |
onConnect()
Template method that can be implemented when the
AbstractChannel.connect(InetSocketAddress, int)
has completed. |
com.hazelcast.internal.networking.nio.NioChannelOptions |
options()
Returns the
ChannelOptions of this Channel. |
NioOutboundPipeline |
outboundPipeline()
Returns the
OutboundPipeline that belongs to this Channel. |
void |
start()
Starts the Channel.
|
String |
toString() |
boolean |
write(OutboundFrame frame)
Queues the
OutboundFrame to be written at some point in the future. |
addCloseListener, attributeMap, close, connect, isClientMode, isClosed, localSocketAddress, notifyCloseListeners, remoteSocketAddress, socket, socketChannel
public NioChannel(SocketChannel socketChannel, boolean clientMode, ChannelInitializer channelInitializer, MetricsRegistry metricsRegistry, Executor closeListenerExecutor)
public com.hazelcast.internal.networking.nio.NioChannelOptions options()
Channel
ChannelOptions
of this Channel.
Call is threadsafe; but calls to the ChannelOptions are not.public void init(NioInboundPipeline inboundPipeline, NioOutboundPipeline outboundPipeline)
public NioOutboundPipeline outboundPipeline()
Channel
OutboundPipeline
that belongs to this Channel.
This method is threadsafe, but most methods on the OutboundPipeline
are not!public NioInboundPipeline inboundPipeline()
Channel
InboundPipeline
that belongs to this Channel.
This method is threadsafe, but most methods on the InboundPipeline
are not!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.protected void onConnect()
AbstractChannel
AbstractChannel.connect(InetSocketAddress, int)
has completed.onConnect
in class AbstractChannel
public long lastReadTimeMillis()
Channel
public long lastWriteTimeMillis()
Channel
public void start()
Channel
Channel.connect(InetSocketAddress, int)
should be called before start is called.
When the Channel is started, the ChannelInitializer
will be called to
initialize the channel and to start with processing inbound and outbound data.
This method is not threadsafe and should be made only once.protected void close0()
AbstractChannel
close0
in class AbstractChannel
public long bytesRead()
Channel
public long bytesWritten()
Channel
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.