Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8226575

OperatingSystemMXBean should be made container aware

XMLWordPrintable

        When Java is running in a container many of the OperatingSystemMXBean accessor methods return host based information rather than container specific data.

        jdk/open/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java contains these native methods which extract Host specific data. These methods should be examine to determine if there is a container specific source of this information.

            private native long getCommittedVirtualMemorySize0();
            private native long getFreePhysicalMemorySize0();
            private native long getFreeSwapSpaceSize0();
            private native long getMaxFileDescriptorCount0();
            private native long getOpenFileDescriptorCount0();
            private native long getProcessCpuTime0();
            private native double getProcessCpuLoad0();
            private native double getSystemCpuLoad0();
            private native long getTotalPhysicalMemorySize0();
            private native long getTotalSwapSpaceSize0();

        These Java methods should first try to extract this information from the internal container Metrics API, if available. Otherwise it should call these existing native methods.

        Here are the Container Metrics implementation classes:

        jdk/open/src/java.base/share/classes/jdk/internal/platform/Container.java
        jdk/open/src/java.base/share/classes/jdk/internal/platform/Metrics.java

              dtitov Daniil Titov (Inactive)
              bobv Bob Vandette (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              15 Start watching this issue

                Created:
                Updated:
                Resolved: