We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 185e84d commit 33284ccCopy full SHA for 33284cc
1 file changed
src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java
@@ -282,8 +282,13 @@ public double getProcessCpuLoad() {
282
}
283
284
private boolean isCpuSetSameAsHostCpuSet() {
285
- if (containerMetrics != null && containerMetrics.getCpuSetCpus() != null) {
286
- return containerMetrics.getCpuSetCpus().length == getHostOnlineCpuCount0();
+ if (containerMetrics != null) {
+ // The return value may change (including from non-null to null) and
287
+ // the call may involve I/O, so keep the result in a local variable.
288
+ int[] cpuSetCpus = containerMetrics.getCpuSetCpus();
289
+ if (cpuSetCpus != null) {
290
+ return cpuSetCpus.length == getHostOnlineCpuCount0();
291
+ }
292
293
return false;
294
0 commit comments