com.hazelcast.util

## Class OperatingSystemMXBeanSupport

- java.lang.Object
- - com.hazelcast.util.OperatingSystemMXBeanSupport

-     public final class OperatingSystemMXBeanSupport
      extends Object

  Support class for reading attributes from OperatingSystemMXBean.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `GET_FREE_PHYSICAL_MEMORY_SIZE_DISABLED` On AIX it can happen that the getFreePhysicalMemorySize method is very slow.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `getSystemLoadAverage()` Reads the system load average attribute from OperatingSystemMXBean.
    `static long` | `readLongAttribute(String attributeName, long defaultValue)` Reads a long attribute from OperatingSystemMXBean.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### GET_FREE_PHYSICAL_MEMORY_SIZE_DISABLED

          public static volatile boolean GET_FREE_PHYSICAL_MEMORY_SIZE_DISABLED

      On AIX it can happen that the getFreePhysicalMemorySize method is very slow. This flags allows one to prevent executing this method and returns the default. This field is made volatile for testing purposes. Having this field volatile isn't relevant for performance since the logic for obtaining the attribute isn't very efficient.

  - ### Method Detail

    - #### readLongAttribute

          public static long readLongAttribute(String attributeName,
                                               long defaultValue)

      Reads a long attribute from OperatingSystemMXBean.
      Parameters:
        `attributeName` - name of the attribute
        `defaultValue` - default value if the attribute value is null
      Returns:
        value of the attribute

    - #### getSystemLoadAverage

          public static double getSystemLoadAverage()

      Reads the system load average attribute from OperatingSystemMXBean.
      Returns:
        system load average or negative value if metric is not available

Copyright © 2019. All rights reserved.