NioSocketChannelConfig Class — netty Architecture
Architecture documentation for the NioSocketChannelConfig class in NioSocketChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 49ee103f_91db_d667_d2d0_67d050418b50["NioSocketChannelConfig"] a898000e_03c9_ff60_bd2a_29311f236921["NioSocketChannel.java"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|defined in| a898000e_03c9_ff60_bd2a_29311f236921 43430d5d_2112_e5da_aba1_9ae12a923784["NioSocketChannelConfig()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 43430d5d_2112_e5da_aba1_9ae12a923784 600cf6ed_ee21_7995_4a8f_279a4d3d2e9f["autoReadCleared()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 600cf6ed_ee21_7995_4a8f_279a4d3d2e9f 77fd682e_1fe5_55f9_eccb_7aa6a764de0c["setOption()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 77fd682e_1fe5_55f9_eccb_7aa6a764de0c b74e3ccf_546f_c18c_e40c_0d5f2fce1535["T()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| b74e3ccf_546f_c18c_e40c_0d5f2fce1535 9b952bb0_56f3_6d97_afd5_ac3e5218bef2["getOptions()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 9b952bb0_56f3_6d97_afd5_ac3e5218bef2 a45573d5_9ffc_26b4_c57e_c71e1d5aee51["setMaxBytesPerGatheringWrite()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| a45573d5_9ffc_26b4_c57e_c71e1d5aee51 9d230ec5_bdc2_68d9_2305_f8304569aa0b["getMaxBytesPerGatheringWrite()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 9d230ec5_bdc2_68d9_2305_f8304569aa0b 16aa05de_cf3a_8d2c_41cb_f991ce788b52["calculateMaxBytesPerGatheringWrite()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| 16aa05de_cf3a_8d2c_41cb_f991ce788b52 f368b8b7_9b3e_1a4a_627b_a87da1d4dbc3["SocketChannel()"] 49ee103f_91db_d667_d2d0_67d050418b50 -->|method| f368b8b7_9b3e_1a4a_627b_a87da1d4dbc3
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java lines 467–526
private final class NioSocketChannelConfig extends DefaultSocketChannelConfig {
private volatile int maxBytesPerGatheringWrite = Integer.MAX_VALUE;
private NioSocketChannelConfig(NioSocketChannel channel, Socket javaSocket) {
super(channel, javaSocket);
calculateMaxBytesPerGatheringWrite();
}
@Override
protected void autoReadCleared() {
clearReadPending();
}
@Override
public NioSocketChannelConfig setSendBufferSize(int sendBufferSize) {
super.setSendBufferSize(sendBufferSize);
calculateMaxBytesPerGatheringWrite();
return this;
}
@Override
public <T> boolean setOption(ChannelOption<T> option, T value) {
if (option instanceof NioChannelOption) {
return NioChannelOption.setOption(jdkChannel(), (NioChannelOption<T>) option, value);
}
return super.setOption(option, value);
}
@Override
public <T> T getOption(ChannelOption<T> option) {
if (option instanceof NioChannelOption) {
return NioChannelOption.getOption(jdkChannel(), (NioChannelOption<T>) option);
}
return super.getOption(option);
}
@Override
public Map<ChannelOption<?>, Object> getOptions() {
return getOptions(super.getOptions(), NioChannelOption.getOptions(jdkChannel()));
}
void setMaxBytesPerGatheringWrite(int maxBytesPerGatheringWrite) {
this.maxBytesPerGatheringWrite = maxBytesPerGatheringWrite;
}
int getMaxBytesPerGatheringWrite() {
return maxBytesPerGatheringWrite;
}
private void calculateMaxBytesPerGatheringWrite() {
// Multiply by 2 to give some extra space in case the OS can process write data faster than we can provide.
int newSendBufferSize = getSendBufferSize() << 1;
if (newSendBufferSize > 0) {
setMaxBytesPerGatheringWrite(newSendBufferSize);
}
}
private SocketChannel jdkChannel() {
return ((NioSocketChannel) channel).javaChannel();
}
}
Source
Frequently Asked Questions
What is the NioSocketChannelConfig class?
NioSocketChannelConfig is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java.
Where is NioSocketChannelConfig defined?
NioSocketChannelConfig is defined in transport/src/main/java/io/netty/channel/socket/nio/NioSocketChannel.java at line 467.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free