Home / Function/ Throwable() — netty Function Reference

Throwable() — netty Function Reference

Architecture documentation for the Throwable() function in PlatformDependent0.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d58337bd_8745_3d47_ca3a_e9b417558f4e["Throwable()"]
  be4c38f2_d236_e498_c295_1033d2617879["PlatformDependent0"]
  d58337bd_8745_3d47_ca3a_e9b417558f4e -->|defined in| be4c38f2_d236_e498_c295_1033d2617879
  2cae8627_cae5_091a_fce1_110ca16bdb9c["equals()"]
  d58337bd_8745_3d47_ca3a_e9b417558f4e -->|calls| 2cae8627_cae5_091a_fce1_110ca16bdb9c
  c2ccf8eb_f7e5_96d2_34ff_36fd7d8bd5d2["javaVersion()"]
  d58337bd_8745_3d47_ca3a_e9b417558f4e -->|calls| c2ccf8eb_f7e5_96d2_34ff_36fd7d8bd5d2
  style d58337bd_8745_3d47_ca3a_e9b417558f4e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent0.java lines 584–625

    private static Throwable explicitNoUnsafeCause0() {
        boolean explicitProperty = SystemPropertyUtil.contains("io.netty.noUnsafe");
        boolean noUnsafe = SystemPropertyUtil.getBoolean("io.netty.noUnsafe", false);
        logger.debug("-Dio.netty.noUnsafe: {}", noUnsafe);

        // See JDK 23 JEP 471 https://openjdk.org/jeps/471 and sun.misc.Unsafe.beforeMemoryAccess() on JDK 23+.
        // And JDK 24 JEP 498 https://openjdk.org/jeps/498, that enable warnings by default.
        // Due to JDK bugs, we only actually disable Unsafe by default on Java 25+, where we have memory segment APIs
        // available, and working.
        String reason = "io.netty.noUnsafe";
        String unspecified = "<unspecified>";
        String unsafeMemoryAccess = SystemPropertyUtil.get("sun.misc.unsafe.memory.access", unspecified);
        if (!explicitProperty && unspecified.equals(unsafeMemoryAccess) && javaVersion() >= 25) {
            reason = "io.netty.noUnsafe=true by default on Java 25+";
            noUnsafe = true;
        } else if (!("allow".equals(unsafeMemoryAccess) || unspecified.equals(unsafeMemoryAccess))) {
            reason = "--sun-misc-unsafe-memory-access=" + unsafeMemoryAccess;
            noUnsafe = true;
        }

        if (noUnsafe) {
            String msg = "sun.misc.Unsafe: unavailable (" + reason + ')';
            logger.debug(msg);
            return new UnsupportedOperationException(msg);
        }

        // Legacy properties
        String unsafePropName;
        if (SystemPropertyUtil.contains("io.netty.tryUnsafe")) {
            unsafePropName = "io.netty.tryUnsafe";
        } else {
            unsafePropName = "org.jboss.netty.tryUnsafe";
        }

        if (!SystemPropertyUtil.getBoolean(unsafePropName, true)) {
            String msg = "sun.misc.Unsafe: unavailable (" + unsafePropName + ')';
            logger.debug(msg);
            return new UnsupportedOperationException(msg);
        }

        return null;
    }

Domain

Subdomains

Frequently Asked Questions

What does Throwable() do?
Throwable() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java.
Where is Throwable() defined?
Throwable() is defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java at line 584.
What does Throwable() call?
Throwable() calls 2 function(s): equals, javaVersion.

Analyze Your Own Codebase

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

Try Supermodel Free