public class GcTimeMonitor extends Thread
Modifier and Type | Class and Description |
---|---|
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.
|
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
GcTimeMonitor(long observationWindowMs,
long sleepIntervalMs,
int maxGcTimePercentage,
GcTimeMonitor.GcTimeAlertHandler alertHandler)
Create an instance of GCTimeMonitor.
|
Modifier and Type | Method and 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, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public 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 shutdown()
public GcTimeMonitor.GcData getLatestGcData()
Copyright © 2020 Apache Software Foundation. All rights reserved.