java.lang.Runnablepublic class GcTimeMonitor
extends java.lang.Thread
| Modifier and Type | Class | Description |
|---|---|---|
static class |
GcTimeMonitor.Builder |
|
static class |
GcTimeMonitor.GcData |
Encapsulates data about GC pauses measured at the specific timestamp.
|
static interface |
GcTimeMonitor.GcTimeAlertHandler |
The user can provide an instance of a class implementing this interface
when initializing a GcTimeMonitor to receive alerts when GC time
percentage exceeds the specified threshold.
|
| Constructor | Description |
|---|---|
GcTimeMonitor(long observationWindowMs,
long sleepIntervalMs,
int maxGcTimePercentage,
GcTimeMonitor.GcTimeAlertHandler alertHandler) |
Create an instance of GCTimeMonitor.
|
| Modifier and Type | Method | Description |
|---|---|---|
GcTimeMonitor.GcData |
getLatestGcData() |
Returns a copy of the most recent data measured by this monitor.
|
void |
run() |
|
void |
shutdown() |
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yieldpublic GcTimeMonitor(long observationWindowMs,
long sleepIntervalMs,
int maxGcTimePercentage,
GcTimeMonitor.GcTimeAlertHandler alertHandler)
observationWindowMs - the interval over which the percentage
of GC time should be calculated. A practical value would be somewhere
between 30 sec and several minutes.sleepIntervalMs - how frequently this thread should wake up to check
GC timings. This is also a frequency with which alertHandler will be
invoked if GC time percentage exceeds the specified limit. A practical
value would likely be 500..1000 ms.maxGcTimePercentage - A GC time percentage limit (0..100) within
observationWindowMs. Once this is exceeded, alertHandler will be
invoked every sleepIntervalMs milliseconds until GC time percentage
falls below this limit.alertHandler - a single method in this interface is invoked when GC
time percentage exceeds the specified limit.public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void shutdown()
public GcTimeMonitor.GcData getLatestGcData()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.