Skip to content

Commit

Permalink
fix apache#1641, support get system load on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
diecui1202 committed Oct 9, 2018
1 parent c4eb4e8 commit e4b3f0e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public Status check() {
try {
Method method = OperatingSystemMXBean.class.getMethod("getSystemLoadAverage", new Class<?>[0]);
load = (Double) method.invoke(operatingSystemMXBean, new Object[0]);
if (load == -1) {
com.sun.management.OperatingSystemMXBean bean =
(com.sun.management.OperatingSystemMXBean) operatingSystemMXBean;
load = bean.getSystemCpuLoad();
}
} catch (Throwable e) {
load = -1;
}
Expand Down

0 comments on commit e4b3f0e

Please sign in to comment.