[ 
https://issues.apache.org/jira/browse/DRILL-6702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596847#comment-16596847
 ] 

ASF GitHub Bot commented on DRILL-6702:
---------------------------------------

vrozov commented on a change in pull request #1437: DRILL-6702: Disable CPU 
Reporting for non-HotSpot JDKs
URL: https://github.com/apache/drill/pull/1437#discussion_r213830706
 
 

 ##########
 File path: common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java
 ##########
 @@ -32,13 +32,22 @@
  */
 @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
+    OperatingSystemMXBean tempOSMXBean;
+    try {
+      tempOSMXBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+    } catch (ClassCastException cce) {
 
 Review comment:
   catch `RuntimeException` or `Exception`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> OperatingSystemMXBean class cast exception when loaded under IBM JVM
> --------------------------------------------------------------------
>
>                 Key: DRILL-6702
>                 URL: https://issues.apache.org/jira/browse/DRILL-6702
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.14.0
>            Reporter: Rob Wu
>            Assignee: Kunal Khatua
>            Priority: Minor
>             Fix For: 1.15.0
>
>
> Related to: https://issues.apache.org/jira/browse/DRILL-6289
>  
> [https://github.com/apache/drill/blob/1.14.0/common/src/main/java/org/apache/drill/exec/metrics/CpuGaugeSet.java#L28|https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_drill_blob_1.14.0_common_src_main_java_org_apache_drill_exec_metrics_CpuGaugeSet.java-23L28&d=DwMFAg&c=cskdkSMqhcnjZxdQVpwTXg&r=-cT6otg6lpT_XkmYy7yg3A&m=f8a5MyR85-7Ns3KmymU7PI8Sk6qW8vRa9HJIa0-npNA&s=mpztPtwrTzNkgLcUORZdl5LQ6gyP5iAf3umFzgdOMeI&e=]
>  
> Exception in thread "main" java.lang.ExceptionInInitializerError
>     at java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
>     at 
> java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
>     at 
> org.apache.drill.exec.metrics.DrillMetrics.getRegistry(DrillMetrics.java:111)
>     at 
> org.apache.drill.exec.memory.AllocationManager.<clinit>(AllocationManager.java:64)
>     at 
> org.apache.drill.exec.memory.BaseAllocator.<clinit>(BaseAllocator.java:48)
>     at 
> org.apache.drill.exec.memory.RootAllocatorFactory.newRoot(RootAllocatorFactory.java:45)
>     at 
> org.apache.drill.exec.memory.RootAllocatorFactory.newRoot(RootAllocatorFactory.java:40)
>     ...
> Caused by: java.lang.ClassCastException: 
> com.ibm.lang.management.ExtendedOperatingSystem incompatible with 
> com.sun.management.OperatingSystemMXBean
>     at org.apache.drill.exec.metrics.CpuGaugeSet.<init>(CpuGaugeSet.java:40)
>     at 
> org.apache.drill.exec.metrics.DrillMetrics$RegistryHolder.registerSystemMetrics(DrillMetrics.java:63)
>     at 
> org.apache.drill.exec.metrics.DrillMetrics$RegistryHolder.<clinit>(DrillMetrics.java:53)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to