Home / Function/ bitMode0() — netty Function Reference

bitMode0() — netty Function Reference

Architecture documentation for the bitMode0() function in PlatformDependent.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d4c011c6_dedc_0731_8350_40bf05ae9242["bitMode0()"]
  2e66d079_807f_6785_864f_73ab09fbc515["PlatformDependent"]
  d4c011c6_dedc_0731_8350_40bf05ae9242 -->|defined in| 2e66d079_807f_6785_864f_73ab09fbc515
  f16ac63e_86d3_38e6_b3a3_dc9e773b8d79["getInt()"]
  d4c011c6_dedc_0731_8350_40bf05ae9242 -->|calls| f16ac63e_86d3_38e6_b3a3_dc9e773b8d79
  2f19db3c_8431_1d24_33ba_7a83b7189b29["equals()"]
  d4c011c6_dedc_0731_8350_40bf05ae9242 -->|calls| 2f19db3c_8431_1d24_33ba_7a83b7189b29
  style d4c011c6_dedc_0731_8350_40bf05ae9242 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent.java lines 1614–1655

    private static int bitMode0() {
        // Check user-specified bit mode first.
        int bitMode = SystemPropertyUtil.getInt("io.netty.bitMode", 0);
        if (bitMode > 0) {
            logger.debug("-Dio.netty.bitMode: {}", bitMode);
            return bitMode;
        }

        // And then the vendor specific ones which is probably most reliable.
        bitMode = SystemPropertyUtil.getInt("sun.arch.data.model", 0);
        if (bitMode > 0) {
            logger.debug("-Dio.netty.bitMode: {} (sun.arch.data.model)", bitMode);
            return bitMode;
        }
        bitMode = SystemPropertyUtil.getInt("com.ibm.vm.bitmode", 0);
        if (bitMode > 0) {
            logger.debug("-Dio.netty.bitMode: {} (com.ibm.vm.bitmode)", bitMode);
            return bitMode;
        }

        // os.arch also gives us a good hint.
        String arch = SystemPropertyUtil.get("os.arch", "").toLowerCase(Locale.US).trim();
        if ("amd64".equals(arch) || "x86_64".equals(arch)) {
            bitMode = 64;
        } else if ("i386".equals(arch) || "i486".equals(arch) || "i586".equals(arch) || "i686".equals(arch)) {
            bitMode = 32;
        }

        if (bitMode > 0) {
            logger.debug("-Dio.netty.bitMode: {} (os.arch: {})", bitMode, arch);
        }

        // Last resort: guess from VM name and then fall back to most common 64-bit mode.
        String vm = SystemPropertyUtil.get("java.vm.name", "").toLowerCase(Locale.US);
        Pattern bitPattern = Pattern.compile("([1-9][0-9]+)-?bit");
        Matcher m = bitPattern.matcher(vm);
        if (m.find()) {
            return Integer.parseInt(m.group(1));
        } else {
            return 64;
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free