NioServerDomainSocketChannel Class — netty Architecture
Architecture documentation for the NioServerDomainSocketChannel class in NioServerDomainSocketChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 715453c3_0f58_2676_dfae_1919ea420212["NioServerDomainSocketChannel"] 2caefa2b_166d_5c45_360d_2a71cc75c69a["NioServerDomainSocketChannel.java"] 715453c3_0f58_2676_dfae_1919ea420212 -->|defined in| 2caefa2b_166d_5c45_360d_2a71cc75c69a 945deb82_fef7_5023_ed66_b2c1389f4acc["ServerSocketChannel()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 945deb82_fef7_5023_ed66_b2c1389f4acc 64ce88cd_93b2_53e6_1797_5609d5ce7d70["NioServerDomainSocketChannel()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 64ce88cd_93b2_53e6_1797_5609d5ce7d70 177b6ce0_dd0a_c475_1a77_947823fceb0e["ChannelConfig()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 177b6ce0_dd0a_c475_1a77_947823fceb0e 3bdab088_59f9_74b0_911f_fddb401d9702["ChannelMetadata()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 3bdab088_59f9_74b0_911f_fddb401d9702 c76d7c4f_e20d_4009_93ee_e2187db11b10["isActive()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| c76d7c4f_e20d_4009_93ee_e2187db11b10 4935e1ce_34df_04bd_22e5_63b86e2589b8["doBind()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 4935e1ce_34df_04bd_22e5_63b86e2589b8 dcf604e3_e18a_3805_e20b_82ccbe031250["doDisconnect()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| dcf604e3_e18a_3805_e20b_82ccbe031250 3678ff56_ce87_ad90_894f_f7fa27080c91["doReadMessages()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 3678ff56_ce87_ad90_894f_f7fa27080c91 388420e6_927f_b6c5_0595_80a88f3f9963["doWriteMessage()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 388420e6_927f_b6c5_0595_80a88f3f9963 672041f4_9621_a34d_c4f2_8c43062e555b["doClose()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 672041f4_9621_a34d_c4f2_8c43062e555b 9db9fa4b_0735_6d00_60ae_ab713b7940d9["SocketAddress()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| 9db9fa4b_0735_6d00_60ae_ab713b7940d9 f1194145_91f6_944c_a2df_0b2c43a389cb["closeOnReadError()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| f1194145_91f6_944c_a2df_0b2c43a389cb d7dc6af8_c85f_d28f_9f27_a9fae31c3be5["doConnect()"] 715453c3_0f58_2676_dfae_1919ea420212 -->|method| d7dc6af8_c85f_d28f_9f27_a9fae31c3be5
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java lines 53–283
public final class NioServerDomainSocketChannel extends AbstractNioMessageChannel
implements io.netty.channel.ServerChannel {
private static final Method OPEN_SERVER_SOCKET_CHANNEL_WITH_FAMILY =
SelectorProviderUtil.findOpenMethod("openServerSocketChannel");
private static final InternalLogger logger = InternalLoggerFactory.getInstance(NioServerDomainSocketChannel.class);
private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16);
private static final SelectorProvider DEFAULT_SELECTOR_PROVIDER = SelectorProvider.provider();
private final NioDomainServerSocketChannelConfig config;
private volatile boolean bound;
// Package-private for testing.
static ServerSocketChannel newChannel(SelectorProvider provider) {
if (PlatformDependent.javaVersion() < 16) {
throw new UnsupportedOperationException("Only supported with Java 16+");
}
try {
ServerSocketChannel channel =
SelectorProviderUtil.newDomainSocketChannel(OPEN_SERVER_SOCKET_CHANNEL_WITH_FAMILY, provider);
if (channel == null) {
throw new ChannelException("Failed to open a socket.");
}
return channel;
} catch (IOException e) {
throw new ChannelException("Failed to open a socket.", e);
}
}
@Override
protected ServerSocketChannel javaChannel() {
return (ServerSocketChannel) super.javaChannel();
}
/**
* Create a new instance
*/
public NioServerDomainSocketChannel() {
this(DEFAULT_SELECTOR_PROVIDER);
}
/**
* Create a new instance using the given {@link SelectorProvider}.
*/
public NioServerDomainSocketChannel(SelectorProvider provider) {
this(newChannel(provider));
}
/**
* Create a new instance using the given {@link ServerSocketChannel}.
*/
public NioServerDomainSocketChannel(ServerSocketChannel channel) {
super(null, channel, SelectionKey.OP_ACCEPT);
if (PlatformDependent.javaVersion() < 16) {
throw new UnsupportedOperationException("Only supported with Java 16+");
}
config = new NioDomainServerSocketChannelConfig(this);
try {
// Check if we already have a local address bound.
bound = channel.getLocalAddress() != null;
} catch (IOException e) {
throw new ChannelException(e);
}
}
@Override
public ChannelConfig config() {
return config;
}
@Override
public ChannelMetadata metadata() {
return METADATA;
}
@Override
public boolean isActive() {
// As java.nio.ServerSocketChannel.isBound() will continue to return true even after the channel was closed
// we will also need to check if it is open.
return isOpen() && bound;
}
@Override
Source
Frequently Asked Questions
What is the NioServerDomainSocketChannel class?
NioServerDomainSocketChannel is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java.
Where is NioServerDomainSocketChannel defined?
NioServerDomainSocketChannel is defined in transport/src/main/java/io/netty/channel/socket/nio/NioServerDomainSocketChannel.java at line 53.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free