jmx-dev RFR: 8345684: OperatingSystemMXBean.getSystemCpuLoad() throws NPE

Roger Riggs rriggs at openjdk.org
Fri Dec 6 17:47:37 UTC 2024


On Fri, 6 Dec 2024 17:05:42 GMT, Fabian Meumertzheim <duke at openjdk.org> wrote:

> The return value of Metrics#getCpuSetCpus may change over time, including from non-null to null across the two calls in this method.

src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java line 278:

> 276:     private boolean isCpuSetSameAsHostCpuSet() {
> 277:         if (containerMetrics != null) {
> 278:             int[] cpuSetCpus = containerMetrics.getCpuSetCpus();

Might be worth a comment about the volatility of getCpuSetCpus() to head off someone changing it back.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22611#discussion_r1873771463


More information about the jmx-dev mailing list