You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ku...@apache.org on 2018/09/05 00:11:13 UTC
[drill] branch master updated: DRILL-6702: Disable CPU Reporting
for non-HotSpot JDKs
This is an automated email from the ASF dual-hosted git repository.
kunal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new cc75188 DRILL-6702: Disable CPU Reporting for non-HotSpot JDKs
cc75188 is described below
commit cc75188d0ce70f102786f69aa070255dd406ff3c
Author: Kunal Khatua <kk...@users.noreply.github.com>
AuthorDate: Tue Sep 4 17:11:10 2018 -0700
DRILL-6702: Disable CPU Reporting for non-HotSpot JDKs
When running Drill on the IBM JDK (J9), the webUI throws an ClassCastException :
Caused by: java.lang.ClassCastException: com.ibm.lang.management.ExtendedOperatingSystem incompatible with com.sun.management.OperatingSystemMXBean
This PR simply disables that, since Drill should ideally be recompiled with these alternative JDKs.
---
.../org/apache/drill/exec/metrics/CpuGaugeSet.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java b/common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
index a652e3c..f1ca2ae 100644
--- a/common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
+++ b/common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
@@ -32,13 +32,15 @@ import com.sun.management.OperatingSystemMXBean;
*/
@SuppressWarnings("restriction")
public class CpuGaugeSet implements MetricSet {
+ private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CpuGaugeSet.class);
- private OperatingSystemMXBean osMXBean;
- private RuntimeMXBean rtMXBean;
+ private final OperatingSystemMXBean osMXBean;
+ private final RuntimeMXBean rtMXBean;
public CpuGaugeSet() {
- this.osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
this.rtMXBean = ManagementFactory.getRuntimeMXBean();
+ //DRILL-6702: Instead of worrying about compiling with IBM JDK, for now, we shall provide no CPU metrics for non-HotSpot JVMs
+ this.osMXBean = getOSMXBeanForCpuMetrics();
}
@Override
@@ -49,6 +51,15 @@ public class CpuGaugeSet implements MetricSet {
metric.put("drillbit.uptime", new DrillbitUptime(rtMXBean));
return metric;
}
+
+ private static OperatingSystemMXBean getOSMXBeanForCpuMetrics() {
+ try {
+ return (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+ } catch (ClassCastException ex) {
+ logger.warn("{}. Detected non-Supported JVM [{}]. CPU Metrics in the WebUI will not be available!", ex.getMessage(), System.getProperty("java.vm.name"));
+ }
+ return null;
+ }
}
/**
@@ -63,7 +74,7 @@ final class OperatingSystemLoad implements Gauge<Double> {
@Override
public Double getValue() {
- return osMXBean.getSystemLoadAverage();
+ return (osMXBean != null) ? osMXBean.getSystemLoadAverage() : null;
}
}
@@ -80,7 +91,7 @@ final class DrillbitProcessLoad implements Gauge<Double> {
@Override
public Double getValue() {
- return osMXBean.getProcessCpuLoad();
+ return (osMXBean != null) ? osMXBean.getProcessCpuLoad() : null;
}
}