Michael Blow has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/2692
Change subject: [NO ISSUE] Don't attempt to log FDs on Windows
......................................................................
[NO ISSUE] Don't attempt to log FDs on Windows
Hyracks collects FD info from the UnixOperatingSystemMXBean; this is not
available on Windows. Avoid trying to use these methods and logging a
NoSuchMethodError when running on Windows.
Change-Id: I7613af4599639d4a5337bb2a45e359660a3faeec
---
M
hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java
1 file changed, 16 insertions(+), 10 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/92/2692/1
diff --git
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java
index ce20d37..4c6ff57 100644
---
a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java
+++
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java
@@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -44,16 +45,21 @@
private static Method getMaxFileDescriptorCount;
static {
- try {
- getOpenFileDescriptorCount =
osMXBean.getClass().getMethod("getOpenFileDescriptorCount");
- getMaxFileDescriptorCount =
osMXBean.getClass().getDeclaredMethod("getMaxFileDescriptorCount");
- getOpenFileDescriptorCount.setAccessible(true);
- getMaxFileDescriptorCount.setAccessible(true);
- } catch (Throwable th) { // NOSONAR: diagnostic code shouldn't cause
server failure
- getOpenFileDescriptorCount = null;
- getMaxFileDescriptorCount = null;
- LOGGER.log(Level.WARN, "Failed setting up the methods to get the
number of file descriptors through {}",
- osMXBean.getClass().getName(), th);
+ if (SystemUtils.IS_OS_WINDOWS) {
+ LOGGER.info("Access to file descriptors (FDs) is not available on
Windows; FD info will not be logged");
+ } else {
+ Class<? extends OperatingSystemMXBean> osMXBeanClass =
osMXBean.getClass();
+ try {
+ getOpenFileDescriptorCount =
osMXBeanClass.getMethod("getOpenFileDescriptorCount");
+ getMaxFileDescriptorCount =
osMXBeanClass.getDeclaredMethod("getMaxFileDescriptorCount");
+ getOpenFileDescriptorCount.setAccessible(true);
+ getMaxFileDescriptorCount.setAccessible(true);
+ } catch (Throwable th) { // NOSONAR: diagnostic code shouldn't
cause server failure
+ getOpenFileDescriptorCount = null;
+ getMaxFileDescriptorCount = null;
+ LOGGER.warn("Failed setting up the methods to get the number
of file descriptors through {}",
+ osMXBeanClass.getName(), th);
+ }
}
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/2692
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7613af4599639d4a5337bb2a45e359660a3faeec
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: Michael Blow <[email protected]>