https://github.com/opentable/otj-pausedetector
Java JVM pause detector library
https://github.com/opentable/otj-pausedetector
pause platform-java
Last synced: 7 months ago
JSON representation
Java JVM pause detector library
- Host: GitHub
- URL: https://github.com/opentable/otj-pausedetector
- Owner: opentable
- Created: 2015-04-21T18:32:34.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-04-19T23:53:13.000Z (about 3 years ago)
- Last Synced: 2024-05-14T00:26:33.567Z (about 1 year ago)
- Topics: pause, platform-java
- Language: Java
- Size: 91.8 KB
- Stars: 3
- Watchers: 25
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
OpenTable JVM Pause Alarm
=========================[](https://travis-ci.org/opentable/otj-pausedetector)
Provide basic notification if the JVM is unable to keep its threads running for extended periods of time
e.g. because of GC, lack of CPU time.Basic Usage
-----------The alarm has very basic configuration available:
* Check interval -- how long to wait between each time check
* Alarm time -- minimum pause to report
* Action on pause -- user-supplied callback when a pause alarms
* Clock -- replace the system clock for testing purposes```java
public class MyCoolApp {
public static void main(String[] args) {
try (new JvmPauseAlarm(100, 400).start()) {
runMyCoolApp();
}
}
}```
This will set up the pause alarm to check every 100ms for pauses of at least 400ms.
Example output:
```
[jvm-pause-alarm] INFO com.opentable.pausedetector.JvmPauseAlarm - Watching JVM for GC pausing. Checking every 10ms for pauses of at least 400ms.
[jvm-pause-alarm] WARN com.opentable.pausedetector.JvmPauseAlarm - Detected pause of 1000ms!
```For Spring, you can import `JvmPauseAlarmConfiguration` and starting / stopping the alarm
is taken care of for you. You then use the following properties to configure it:```
ot.jvm-pause.enabled=true
ot.jvm-pause.check-time=PT0.05s
ot.jvm-pause.pause-time=PT0.2s
```----
Copyright (C) 2016 OpenTable, Inc.