Native Class — netty Architecture
Architecture documentation for the Native class in Native.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb["Native"] 9f60ae89_ce46_d25a_f8d3_7b9e7c2ff6f2["Native.java"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|defined in| 9f60ae89_ce46_d25a_f8d3_7b9e7c2ff6f2 aa58c17b_843c_f7a2_86c3_318b987b534d["String()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| aa58c17b_843c_f7a2_86c3_318b987b534d 24f8b1e0_7e28_2451_d646_864923caca80["setupFlags()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 24f8b1e0_7e28_2451_d646_864923caca80 29227663_eebd_aa7b_0e19_1e98cdbf3ed7["RingBuffer()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 29227663_eebd_aa7b_0e19_1e98cdbf3ed7 f9807934_6660_7593_402b_26db1096e1ff["checkAllIOSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| f9807934_6660_7593_402b_26db1096e1ff 5856764b_fc22_f609_fee4_37945a1485fb["isRecvMultishotSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 5856764b_fc22_f609_fee4_37945a1485fb 858a6f0d_b161_028b_819e_d48532a32a92["isAcceptMultishotSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 858a6f0d_b161_028b_819e_d48532a32a92 418ab767_2918_dbbb_1df2_c3c8ec9b75d3["isCqeFSockNonEmptySupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 418ab767_2918_dbbb_1df2_c3c8ec9b75d3 e523aa17_0e35_0d2f_5085_459d9f8f78c0["isSpliceSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| e523aa17_0e35_0d2f_5085_459d9f8f78c0 0dbaf346_8826_00e6_a959_35fa481ccae2["isPollAddMultiShotSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 0dbaf346_8826_00e6_a959_35fa481ccae2 55b751ed_70bd_653e_15ae_65b49e20cb4a["isSendZcSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 55b751ed_70bd_653e_15ae_65b49e20cb4a 8f4292e9_a9a1_a9bd_d11e_2b8a6290d13e["isSendmsgZcSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 8f4292e9_a9a1_a9bd_d11e_2b8a6290d13e 148273d7_17cf_82f1_35a6_856d57a1a578["isRegisterIoWqWorkerSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 148273d7_17cf_82f1_35a6_856d57a1a578 6a1baa44_1a9d_4915_4f59_ebf4f282e50d["isRegisterBufferRingSupported()"] 6ddaf968_1eb9_8057_3938_2ad6d5ebbbeb -->|method| 6a1baa44_1a9d_4915_4f59_ebf4f282e50d
Relationship Graph
Source Code
transport-classes-io_uring/src/main/java/io/netty/channel/uring/Native.java lines 39–675
final class Native {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(Native.class);
static {
Selector selector = null;
try {
// We call Selector.open() as this will under the hood cause IOUtil to be loaded.
// This is a workaround for a possible classloader deadlock that could happen otherwise:
//
// See https://github.com/netty/netty/issues/10187
selector = Selector.open();
} catch (IOException ignore) {
// Just ignore
}
// Preload all classes that will be used in the OnLoad(...) function of JNI to eliminate the possiblity of a
// class-loader deadlock. This is a workaround for https://github.com/netty/netty/issues/11209.
// This needs to match all the classes that are loaded via NETTY_JNI_UTIL_LOAD_CLASS or looked up via
// NETTY_JNI_UTIL_FIND_CLASS.
ClassInitializerUtil.tryLoadClasses(
Native.class,
// netty_io_uring_linuxsocket
PeerCredentials.class, java.io.FileDescriptor.class
);
File tmpDir = PlatformDependent.tmpdir();
Path tmpFile = tmpDir.toPath().resolve("netty_io_uring.tmp");
try {
// First, try calling a side-effect free JNI method to see if the library was already
// loaded by the application.
Native.createFile(tmpFile.toString());
} catch (UnsatisfiedLinkError ignore) {
// The library was not previously loaded, load it now.
loadNativeLibrary();
} finally {
tmpFile.toFile().delete();
try {
if (selector != null) {
selector.close();
}
} catch (IOException ignore) {
// Just ignore
}
}
Unix.registerInternal(Native::registerUnix);
}
static final int SOCK_NONBLOCK = NativeStaticallyReferencedJniMethods.sockNonblock();
static final int SOCK_CLOEXEC = NativeStaticallyReferencedJniMethods.sockCloexec();
static final short AF_INET = (short) NativeStaticallyReferencedJniMethods.afInet();
static final short AF_INET6 = (short) NativeStaticallyReferencedJniMethods.afInet6();
static final short AF_UNIX = (short) NativeStaticallyReferencedJniMethods.afUnix();
static final int SIZEOF_SOCKADDR_STORAGE = NativeStaticallyReferencedJniMethods.sizeofSockaddrStorage();
static final int SIZEOF_SOCKADDR_UN = NativeStaticallyReferencedJniMethods.sizeofSockaddrUn();
static final int SOCKADDR_UN_OFFSETOF_SUN_FAMILY =
NativeStaticallyReferencedJniMethods.sockaddrUnOffsetofSunFamily();
static final int SOCKADDR_UN_OFFSETOF_SUN_PATH =
NativeStaticallyReferencedJniMethods.sockaddrUnOffsetofSunPath();
static final int MAX_SUN_PATH_LEN =
NativeStaticallyReferencedJniMethods.maxSunPathLen();
static final int SIZEOF_SOCKADDR_IN = NativeStaticallyReferencedJniMethods.sizeofSockaddrIn();
static final int SIZEOF_SOCKADDR_IN6 = NativeStaticallyReferencedJniMethods.sizeofSockaddrIn6();
static final int SOCKADDR_IN_OFFSETOF_SIN_FAMILY =
NativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinFamily();
static final int SOCKADDR_IN_OFFSETOF_SIN_PORT = NativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinPort();
static final int SOCKADDR_IN_OFFSETOF_SIN_ADDR = NativeStaticallyReferencedJniMethods.sockaddrInOffsetofSinAddr();
static final int IN_ADDRESS_OFFSETOF_S_ADDR = NativeStaticallyReferencedJniMethods.inAddressOffsetofSAddr();
static final int SOCKADDR_IN6_OFFSETOF_SIN6_FAMILY =
NativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Family();
static final int SOCKADDR_IN6_OFFSETOF_SIN6_PORT =
NativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Port();
static final int SOCKADDR_IN6_OFFSETOF_SIN6_FLOWINFO =
NativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Flowinfo();
static final int SOCKADDR_IN6_OFFSETOF_SIN6_ADDR =
NativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6Addr();
static final int SOCKADDR_IN6_OFFSETOF_SIN6_SCOPE_ID =
NativeStaticallyReferencedJniMethods.sockaddrIn6OffsetofSin6ScopeId();
static final int IN6_ADDRESS_OFFSETOF_S6_ADDR = NativeStaticallyReferencedJniMethods.in6AddressOffsetofS6Addr();
static final int SIZEOF_SIZE_T = NativeStaticallyReferencedJniMethods.sizeofSizeT();
static final int SIZEOF_IOVEC = NativeStaticallyReferencedJniMethods.sizeofIovec();
Source
Frequently Asked Questions
What is the Native class?
Native is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/Native.java.
Where is Native defined?
Native is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/Native.java at line 39.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free