Home / Class/ Unix Class — netty Architecture

Unix Class — netty Architecture

Architecture documentation for the Unix class in Unix.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0cef8967_b94b_e135_e887_7bc007d9ef4e["Unix"]
  8b0be878_fd41_4f28_2ef2_18b1d20ad999["Unix.java"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|defined in| 8b0be878_fd41_4f28_2ef2_18b1d20ad999
  64e3de55_88d2_d0be_cafd_96629224ebeb["registerInternal()"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|method| 64e3de55_88d2_d0be_cafd_96629224ebeb
  2546c9d9_09ac_0407_2b96_fff47c76815f["isAvailable()"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|method| 2546c9d9_09ac_0407_2b96_fff47c76815f
  b096e44c_5d06_a89a_069f_131aa50ec7a3["ensureAvailability()"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|method| b096e44c_5d06_a89a_069f_131aa50ec7a3
  a559c1bd_388b_7e2b_86f7_4b557c928e7a["Throwable()"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|method| a559c1bd_388b_7e2b_86f7_4b557c928e7a
  26787b9f_05f4_2633_a924_39a65d1f503d["Unix()"]
  0cef8967_b94b_e135_e887_7bc007d9ef4e -->|method| 26787b9f_05f4_2633_a924_39a65d1f503d

Relationship Graph

Source Code

transport-native-unix-common/src/main/java/io/netty/channel/unix/Unix.java lines 31–94

public final class Unix {
    private static final AtomicBoolean registered = new AtomicBoolean();

    static {
        // 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(Unix.class,
                // netty_unix_errors
                OutOfMemoryError.class, RuntimeException.class, ClosedChannelException.class,
                IOException.class, PortUnreachableException.class,

                // netty_unix_socket
                DatagramSocketAddress.class, DomainDatagramSocketAddress.class, InetSocketAddress.class
        );
    }

    /**
     * Internal method... Should never be called from the user.
     *
     * @param registerTask
     */
    @UnstableApi
    public static synchronized void registerInternal(Runnable registerTask) {
        registerTask.run();
        Socket.initialize();
    }

    /**
     * Returns {@code true} if and only if the <a href="https://netty.io/wiki/native-transports.html">{@code
     * netty_transport_native_unix}</a> is available.
     */
    @Deprecated
    public static boolean isAvailable() {
        return false;
    }

    /**
     * Ensure that <a href="https://netty.io/wiki/native-transports.html">{@code netty_transport_native_unix}</a> is
     * available.
     *
     * @throws UnsatisfiedLinkError if unavailable
     */
    @Deprecated
    public static void ensureAvailability() {
       throw new UnsupportedOperationException();
    }

    /**
     * Returns the cause of unavailability of <a href="https://netty.io/wiki/native-transports.html">
     * {@code netty_transport_native_unix}</a>.
     *
     * @return the cause if unavailable. {@code null} if available.
     */
    @Deprecated
    public static Throwable unavailabilityCause() {
        return new UnsupportedOperationException();
    }

    private Unix() {
    }
}

Frequently Asked Questions

What is the Unix class?
Unix is a class in the netty codebase, defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/Unix.java.
Where is Unix defined?
Unix is defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/Unix.java at line 31.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free