NOTE
Channel Class Hierarchy
1. Channel class hierarchy 2. Config class hierarchy
This is a historical learning note and may contain outdated or incomplete understanding.
1. Channel Class Hierarchy

1.1. Channel
Used for network I/O.
* A nexus to a network socket or a component which is capable of I/O
* operations such as read, write, connect, and bind.
public interface Channel extends AttributeMap, ChannelOutboundInvoker, Comparable<Channel> {
1.2. AbstractChannel
A skeletal implementation of Channel.
/**
* A skeletal {@link Channel} implementation.
*/
private final Channel parent;
private final ChannelId id;
private final Unsafe unsafe;
private final DefaultChannelPipeline pipeline;
private final CloseFuture closeFuture = new CloseFuture(this);
private volatile SocketAddress localAddress;
private volatile SocketAddress remoteAddress;
private volatile EventLoop eventLoop;
1.3. AbstractNioChannel
A Channel implemented using a Selector.
/**
* Abstract base class for {@link Channel} implementations which use a Selector based approach.
*/
public abstract class AbstractNioChannel extends AbstractChannel {
1.4. AbstractNioByteChannel
A client-side channel that operates on byte streams and is interested in READ events.
/**
* {@link AbstractNioChannel} base class for {@link Channel}s that operate on bytes.
*/
public abstract class AbstractNioByteChannel extends AbstractNioChannel {
protected AbstractNioByteChannel(Channel parent, SelectableChannel ch) {
super(parent, ch, SelectionKey.OP_READ);
}
}
1.5. AbstractNioMessageChannel
A server-side channel interested in accept events.
/**
* A {@link io.netty.channel.socket.ServerSocketChannel} implementation which uses
* NIO selector based implementation to accept new connections.
*/
public class NioServerSocketChannel extends AbstractNioMessageChannel
implements io.netty.channel.socket.ServerSocketChannel {
public NioServerSocketChannel(ServerSocketChannel channel) {
super(null, channel, SelectionKey.OP_ACCEPT);
config = new NioServerSocketChannelConfig(this, javaChannel().socket());
}
}
2. Config Class Hierarchy

Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub