Home / Function/ processHandlePid() — netty Function Reference

processHandlePid() — netty Function Reference

Architecture documentation for the processHandlePid() function in DefaultChannelId.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f0c7f7e4_2aba_5506_a08d_94bc7c7bd25a["processHandlePid()"]
  20dcb0e9_635a_927e_e4b0_31b79bc84709["DefaultChannelId"]
  f0c7f7e4_2aba_5506_a08d_94bc7c7bd25a -->|defined in| 20dcb0e9_635a_927e_e4b0_31b79bc84709
  478fc34f_b108_10df_c8a9_c1549c05cf81["defaultProcessId()"]
  478fc34f_b108_10df_c8a9_c1549c05cf81 -->|calls| f0c7f7e4_2aba_5506_a08d_94bc7c7bd25a
  style f0c7f7e4_2aba_5506_a08d_94bc7c7bd25a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/DefaultChannelId.java lines 114–135

    static int processHandlePid(ClassLoader loader) {
        // pid is positive on unix, non{-1,0} on windows
        int nilValue = -1;
        if (PlatformDependent.javaVersion() >= 9) {
            Long pid;
            try {
                Class<?> processHandleImplType = Class.forName("java.lang.ProcessHandle", true, loader);
                Method processHandleCurrent = processHandleImplType.getMethod("current");
                Object processHandleInstance = processHandleCurrent.invoke(null);
                Method processHandlePid = processHandleImplType.getMethod("pid");
                pid = (Long) processHandlePid.invoke(processHandleInstance);
            } catch (Exception e) {
                logger.debug("Could not invoke ProcessHandle.current().pid();", e);
                return nilValue;
            }
            if (pid > Integer.MAX_VALUE || pid < Integer.MIN_VALUE) {
                throw new IllegalStateException("Current process ID exceeds int range: " + pid);
            }
            return pid.intValue();
        }
        return nilValue;
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does processHandlePid() do?
processHandlePid() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/DefaultChannelId.java.
Where is processHandlePid() defined?
processHandlePid() is defined in transport/src/main/java/io/netty/channel/DefaultChannelId.java at line 114.
What calls processHandlePid()?
processHandlePid() is called by 1 function(s): defaultProcessId.

Analyze Your Own Codebase

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

Try Supermodel Free