JvmPauseMonitor (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.util

## Class JvmPauseMonitor

- java.lang.Object
- - org.apache.zookeeper.server.util.JvmPauseMonitor

-     public class JvmPauseMonitor
      extends Object

  This code is originally from hadoop-common, see: https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java Class which sets up a simple thread which runs in a loop sleeping for a short interval of time. If the sleep takes significantly longer than its target time, it implies that the JVM or host machine has paused processing, which may cause other problems. If such a pause is detected, the thread logs a message.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `INFO_THRESHOLD_DEFAULT`
    `static String` | `INFO_THRESHOLD_KEY`
    `protected long` | `infoThresholdMs` log INFO if we detect a pause longer than this threshold
    `static String` | `JVM_PAUSE_MONITOR_FEATURE_SWITCH_KEY`
    `static long` | `SLEEP_TIME_MS_DEFAULT`
    `static String` | `SLEEP_TIME_MS_KEY`
    `protected long` | `sleepTimeMs` The target sleep time
    `static long` | `WARN_THRESHOLD_DEFAULT`
    `static String` | `WARN_THRESHOLD_KEY`
    `protected long` | `warnThresholdMs` log WARN if we detect a pause longer than this threshold

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JvmPauseMonitor(QuorumPeerConfig config)`
    `JvmPauseMonitor(ServerConfig config)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getNumGcInfoThresholdExceeded()`
    `long` | `getNumGcWarnThresholdExceeded()`
    `long` | `getTotalGcExtraSleepTime()`
    `boolean` | `isStarted()`
    `void` | `serviceStart()`
    `void` | `serviceStop()`

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

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

- - ### Field Detail

    - #### JVM_PAUSE_MONITOR_FEATURE_SWITCH_KEY

          public static final String JVM_PAUSE_MONITOR_FEATURE_SWITCH_KEY

      See Also:
        Constant Field Values

    - #### sleepTimeMs

          protected long sleepTimeMs

      The target sleep time

    - #### SLEEP_TIME_MS_KEY

          public static final String SLEEP_TIME_MS_KEY

      See Also:
        Constant Field Values

    - #### SLEEP_TIME_MS_DEFAULT

          public static final long SLEEP_TIME_MS_DEFAULT

      See Also:
        Constant Field Values

    - #### warnThresholdMs

          protected long warnThresholdMs

      log WARN if we detect a pause longer than this threshold

    - #### WARN_THRESHOLD_KEY

          public static final String WARN_THRESHOLD_KEY

      See Also:
        Constant Field Values

    - #### WARN_THRESHOLD_DEFAULT

          public static final long WARN_THRESHOLD_DEFAULT

      See Also:
        Constant Field Values

    - #### infoThresholdMs

          protected long infoThresholdMs

      log INFO if we detect a pause longer than this threshold

    - #### INFO_THRESHOLD_KEY

          public static final String INFO_THRESHOLD_KEY

      See Also:
        Constant Field Values

    - #### INFO_THRESHOLD_DEFAULT

          public static final long INFO_THRESHOLD_DEFAULT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JvmPauseMonitor

          public JvmPauseMonitor(QuorumPeerConfig config)

    - #### JvmPauseMonitor

          public JvmPauseMonitor(ServerConfig config)

  - ### Method Detail

    - #### serviceStart

          public void serviceStart()

    - #### serviceStop

          public void serviceStop()

    - #### isStarted

          public boolean isStarted()

    - #### getNumGcWarnThresholdExceeded

          public long getNumGcWarnThresholdExceeded()

    - #### getNumGcInfoThresholdExceeded

          public long getNumGcInfoThresholdExceeded()

    - #### getTotalGcExtraSleepTime

          public long getTotalGcExtraSleepTime()

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.