HuangZhenQiu commented on code in PR #26492:
URL: https://github.com/apache/flink/pull/26492#discussion_r2058608705


##########
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/util/MetricUtils.java:
##########
@@ -338,6 +339,30 @@ static void instantiateMetaspaceMemoryMetrics(final 
MetricGroup parentMetricGrou
         }
     }
 
+    static void instantiateFileDescriptorMetrics(MetricGroup metrics) {
+        try {
+            final com.sun.management.OperatingSystemMXBean mxBean =
+                    (com.sun.management.OperatingSystemMXBean)
+                            ManagementFactory.getOperatingSystemMXBean();
+
+            if (mxBean instanceof 
com.sun.management.UnixOperatingSystemMXBean) {

Review Comment:
   The target java version of current main branch of Flink is java 17. The 
class com.sun.management.UnixOperatingSystemMXBean exist since all Java 1.5. 
   
https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/UnixOperatingSystemMXBean.html.
   
   But whether UnixOperatingSystemMXBean can be returned, depends on underneath 
OS. It user run the flink code in window locally, I guess 
UnixOperatingSystemMXBean will not be created. Thus, we throw exception in this 
case. In the end, the error log will print the exception stack.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to