This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/2.6.x by this push:
     new 0b94b35  fix #1641, support get system load on windows. (#2621)
0b94b35 is described below

commit 0b94b35992259747611ffae2d807f87b4ed4b705
Author: Jerrick Zhu <[email protected]>
AuthorDate: Wed Oct 10 10:59:59 2018 +0800

    fix #1641, support get system load on windows. (#2621)
---
 .../com/alibaba/dubbo/common/status/support/LoadStatusChecker.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/status/support/LoadStatusChecker.java
 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/status/support/LoadStatusChecker.java
index 20715c5..0ed290f 100644
--- 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/status/support/LoadStatusChecker.java
+++ 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/status/support/LoadStatusChecker.java
@@ -37,6 +37,11 @@ public class LoadStatusChecker implements StatusChecker {
         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;
         }

Reply via email to