SelectorProviderUtil Class — netty Architecture
Architecture documentation for the SelectorProviderUtil class in SelectorProviderUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e74599f0_286c_2ede_da95_e80945d6ea4f["SelectorProviderUtil"] c76a1ea4_af28_104c_783d_d161eae51d49["SelectorProviderUtil.java"] e74599f0_286c_2ede_da95_e80945d6ea4f -->|defined in| c76a1ea4_af28_104c_783d_d161eae51d49 fae27d6e_7138_d91b_219c_525154bcda6b["Method()"] e74599f0_286c_2ede_da95_e80945d6ea4f -->|method| fae27d6e_7138_d91b_219c_525154bcda6b 129214bf_1aed_8f1b_6b89_9afad7be2131["C()"] e74599f0_286c_2ede_da95_e80945d6ea4f -->|method| 129214bf_1aed_8f1b_6b89_9afad7be2131 0d38e693_1318_4e94_970a_493aa6b90cfc["SelectorProviderUtil()"] e74599f0_286c_2ede_da95_e80945d6ea4f -->|method| 0d38e693_1318_4e94_970a_493aa6b90cfc
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/nio/SelectorProviderUtil.java lines 31–78
final class SelectorProviderUtil {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SelectorProviderUtil.class);
static Method findOpenMethod(String methodName) {
if (PlatformDependent.javaVersion() >= 15) {
try {
return SelectorProvider.class.getMethod(methodName, java.net.ProtocolFamily.class);
} catch (Throwable e) {
logger.debug("SelectorProvider.{}(ProtocolFamily) not available, will use default", methodName, e);
}
}
return null;
}
/**
* Use the {@link SelectorProvider} to open {@link SocketChannel} and so remove condition in
* {@link SelectorProvider#provider()} which is called by each SocketChannel.open() otherwise.
* <p>
* See <a href="https://github.com/netty/netty/issues/2308">#2308</a>.
*/
private static <C extends Channel> C newChannel(Method method, SelectorProvider provider,
Object family) throws IOException {
if (family != null && method != null) {
try {
@SuppressWarnings("unchecked")
C channel = (C) method.invoke(provider, family);
return channel;
} catch (InvocationTargetException | IllegalAccessException e) {
throw new IOException(e);
}
}
return null;
}
static <C extends Channel> C newChannel(Method method, SelectorProvider provider,
SocketProtocolFamily family) throws IOException {
if (family != null) {
return newChannel(method, provider, family.toJdkFamily());
}
return null;
}
static <C extends Channel> C newDomainSocketChannel(Method method, SelectorProvider provider) throws IOException {
return newChannel(method, provider, StandardProtocolFamily.valueOf("UNIX"));
}
private SelectorProviderUtil() { }
}
Source
Frequently Asked Questions
What is the SelectorProviderUtil class?
SelectorProviderUtil is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/SelectorProviderUtil.java.
Where is SelectorProviderUtil defined?
SelectorProviderUtil is defined in transport/src/main/java/io/netty/channel/socket/nio/SelectorProviderUtil.java at line 31.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free