public final class NioEventLoopGroup extends Object implements EventLoopGroup
EventLoopGroup implementation that makes use of
Selector to have a limited set of io threads, handle
an arbitrary number of connections.
Each NioChannel has 2 parts:
NioInboundPipeline: triggered by the NioThread when data is available
in the socket. The NioInboundPipeline takes care of reading data from the socket
and calling the appropriate
ChannelInboundHandlerNioOutboundPipeline: triggered by the NioThread when either space
is available in the socket for writing, or when there is something that needs to
be written e.g. a Packet. The NioOutboundPipeline takes care of calling the
appropriate ChannelOutboundHandler
to convert the OutboundFrame to bytes
in in the ByteBuffer and writing it to the socket.
NioThread blocks on the Selector, but it can be put in a
'selectNow' mode that makes it spinning on the selector. This is an experimental
feature and will cause the io threads to run hot. For this reason, when this feature
is enabled, the number of io threads should be reduced (preferably 1).| Modifier and Type | Class and Description |
|---|---|
static class |
NioEventLoopGroup.Context |
| Constructor and Description |
|---|
NioEventLoopGroup(NioEventLoopGroup.Context ctx) |
| Modifier and Type | Method and Description |
|---|---|
NioThread[] |
getInputThreads() |
IOBalancer |
getIOBalancer() |
NioThread[] |
getOutputThreads() |
void |
register(Channel channel)
Registers a channel at this
EventLoopGroup. |
void |
shutdown()
Shuts down this EventLoopGroup.
|
void |
start()
Starts this EventLoopGroup.
|
public NioEventLoopGroup(NioEventLoopGroup.Context ctx)
public NioThread[] getInputThreads()
public NioThread[] getOutputThreads()
public IOBalancer getIOBalancer()
public void start()
EventLoopGroupstart in interface EventLoopGrouppublic void shutdown()
EventLoopGroupshutdown in interface EventLoopGrouppublic void register(Channel channel)
EventLoopGroupEventLoopGroup.
Every Channel should be registered at at most 1 EventLoopGroup and it is very unlikely that during the lifespan of the
Channel, it will change its EventLoopGroup.register in interface EventLoopGroupchannel - the channel to register.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.