Michael Blow has submitted this change and it was merged. 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 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2692 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: abdullah alamoudi <[email protected]> --- M hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/MXHelper.java 1 file changed, 16 insertions(+), 10 deletions(-) Approvals: Anon. E. Moose #1000171: abdullah alamoudi: Looks good to me, approved Jenkins: Verified; No violations found; Verified 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: merged Gerrit-Change-Id: I7613af4599639d4a5337bb2a45e359660a3faeec Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: release-0.9.4-pre-rc Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
