File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/jdk.management/unix/classes/com/sun/management/internal Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -274,8 +274,13 @@ public double getProcessCpuLoad() {
274274 }
275275
276276 private boolean isCpuSetSameAsHostCpuSet () {
277- if (containerMetrics != null && containerMetrics .getCpuSetCpus () != null ) {
278- return containerMetrics .getCpuSetCpus ().length == getHostOnlineCpuCount0 ();
277+ if (containerMetrics != null ) {
278+ // The return value may change (including from non-null to null) and
279+ // the call may involve I/O, so keep the result in a local variable.
280+ int [] cpuSetCpus = containerMetrics .getCpuSetCpus ();
281+ if (cpuSetCpus != null ) {
282+ return cpuSetCpus .length == getHostOnlineCpuCount0 ();
283+ }
279284 }
280285 return false ;
281286 }
You can’t perform that action at this time.
0 commit comments