public interface GarbageCollectorMXBean extends MemoryManagerMXBean
GarbageCollectorMXBean
is an interface used by the management
system to access garbage collector properties and reset the values of
associated counter and accumulator properties.
ObjectName
pattern: com.azul.zing:type=GarbageCollector,name=collector_name
getPercentageOfTimeCollectorIsRunning()
provides a powerful method for monitoring the health of your application.
For this collector, the value returned represents the approximate percentage
of time that this collector’s threads were running and doing a collection
over the interval starting
when the penultimate collection that this collector completed to the end
of the most recently completed (referred to as last) collection for this collector.
The percentage will only be calculated at the end of the collection when
the collection has completed.
Examples:
Key: Time collector is not running: ----- Time collector is running: rrrrr Example of a garbage collector spending 5% of its time collecting: percentage end of end of of time penultimate last running | | 5 % --------------------------------------rr ----- wall clock time ----> Other good percentages that allow time for application threads to work: percentage end of end of of time penultimate last running | | 10 % ------------------------------------rrrr ----- 20 % --------------------------------rrrrrrrr ----- 30 % ----------------------------rrrrrrrrrrrr ----- wall clock time ----> Percentages considered too high for good performance (increase -Xmx!): percentage end of end of of time penultimate last running | | 50 % --------------------rrrrrrrrrrrrrrrrrrrr ----- 90 % ----rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ----- wall clock time ---->
Use the value returned from getPercentageOfTimeCollectorIsRunning()
to monitor the health of your application. Normally,
the garbage collector should spend less than 30% of wall clock time running
so that the application threads have sufficient CPU resources
to get the application’s work done.
If the garbage collector runs for a higher percentage of time, you will
want to increase the size of the Java heap or decrease the load on the
application.
A call to getPercentageOfTimeCollectorIsRunning()
answers the
question about the relative amount of time spent garbage collecting for this
collector. The Java virtual
machine also keeps track of the maximum percentage of time this collector
has been running.
Access the Java virtual machine’s stored maximum value and reset the
stored maximum value using:
getHighestPercentageOfTimeCollectorIsRunning()
resetHighestPercentageOfTimeCollectorIsRunning()
getTimeOfLastResetHighestPercentageOfTimeCollectorIsRunning()
The setPercentageOfTimeCollectorIsRunningThreshold(double)
sets a threshold
which, when exceeded during application execution, increments a counter,
accessible by calling the
method, getPercentageOfTimeCollectorIsRunningThresholdExceededCount()
.
Additional methods return the currently set threshold value and whether
the threshold has been exceeded in the interval between the end of the
penultimate collection and the end of the last collection for this collector:
getPercentageOfTimeCollectorIsRunningThreshold()
isPercentageOfTimeCollectorIsRunningThresholdExceeded()
When the threshold value is zero, no threshold tracking is done
for the percentage of time this collector is running.
Use of the setPercentageOfTimeCollectorIsRunningThreshold(double)
method
to set a threshold greater than zero turns on tracking of threshold violations
and enables use of notifications. Notifications for exceeding the threshold
for the percentage of time the collector is running are of type described by
the field: PERCENTAGE_OF_TIME_COLLECTOR_IS_RUNNING_THRESHOLD_EXCEEDED
in GarbageCollectorNotificationInfo
.
A notification is only generated when the threshold is crossed. If the percentage of time the collector is running remains above the threshold, no new notifications are generated until the value falls below and then climbs above the threshold value.
Use setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded(long)
to enable repeated notifications at a minimum selected interval when the percentage
exceeds the threshold. Its use is designed to avoid problems associated with
missing a single notification.
Use getIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded()
to
return the value for the currently set interval (seconds).
Notifications are easy to set up using the GarbageCollectorMXBeans. Here is an
example that sets up a listener for notifications from each of the collectors.
Extracting information from the javax.management.Notification
object
that is delivered with the garbage collection notification is also in the example code.
Build the client program using:
$JAVA_HOME/javac -cp $JAVA_HOME/etc/extensions/mxbeans/agents/ZingJMM.jar ClientGCNotification.java
import javax.management.JMX; import javax.management.MBeanServerConnection; import javax.management.Notification; import javax.management.NotificationListener; import javax.management.ObjectName; import javax.management.openmbean.CompositeData; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import com.azul.zing.management.GCDetails; import com.azul.zing.management.GarbageCollectorMXBean; import com.azul.zing.management.GarbageCollectorNotificationInfo; public class ClientGCNotification { // Class to handle notifications public static class ClientListener implements NotificationListener { @Override public void handleNotification(Notification notification, Object handback) { if (notification.getType().equals(GarbageCollectorNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) { // Get the information associated with this notification long sequenceNumber = notification.getSequenceNumber(); long timeStamp = notification.getTimeStamp(); String type = notification.getType(); // Access NotificationInfo attributes GarbageCollectorNotificationInfo info = GarbageCollectorNotificationInfo.from((CompositeData) notification.getUserData()); String collectorName = info.getCollectorName(); String notificationReason = info.getNotificationReason(); long count = info.getCount(); // Access the GCDetails collection details GCDetails gcDetails = info.getGCDetails(); long id = gcDetails.getId(); double startTime = gcDetails.getStartTime(); double endTime = gcDetails.getEndTime(); double duration = gcDetails.getCollectionDuration(); String garbageCollectionCause = gcDetails.getGarbageCollectionCause(); double percentTimeRunning = gcDetails.getPercentageOfTimeCollectorIsRunning(); System.out.println("sequenceNumber = " + sequenceNumber + " timeStamp = " + timeStamp + " collectorName = " + collectorName + " id = " + id + " startTime = " + startTime + " duration = " + duration + " garbageCollectionCause = " + garbageCollectionCause + " percentTimeRunning = " + percentTimeRunning); // Your code ... } else if (notification.getType().equals(GarbageCollectorNotificationInfo.PERCENTAGE_OF_TIME_COLLECTOR_IS_RUNNING_THRESHOLD_EXCEEDED )) { // To receive this notification, you must set the threshold // using the GarbageCollector's MXBean operation // setPercentageOfTimeCollectorIsRunningThreshold to a value // other than zero // Your code ... } } } public static void main(String[] args) throws Exception { String ipAddr = args[0]; // IP address of the machine where the server is running String port = args[1]; // Port specified when starting the server using: // -Dcom.sun.management.jmxremote \ // -Dcom.sun.management.jmxremote.port=${listeningOnPort} \ // -Dcom.sun.management.jmxremote.authenticate=false \ // -Dcom.sun.management.jmxremote.ssl=false \ // Create an RMI connector client and connect to the RMI connector server // Protocol: // service:jmx:protocol:sap // //[host[:port]][url-path] // new JMXServiceURL("service:jmx:rmi: ///jndi/rmi://:9999/jmxrmi"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+ ipAddr + ":" + port + "/jmxrmi"); JMXConnector jmxc = JMXConnectorFactory.connect(url, null); // Greate an MBeanServerConnection MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); // Set up to montitor the notifications generated by the GC MXBeans // Construct the ObjectName for the GPGC New and GPGC Old collector ObjectName mbeanNameNewGen = new ObjectName("com.azul.zing:type=GarbageCollector,name=GPGC New"); ObjectName mbeanNameOldGen = new ObjectName("com.azul.zing:type=GarbageCollector,name=GPGC Old"); // Create proxies for the MXBean instead of going through the MBean server connection GarbageCollectorMXBean newGenCollectorMXBeanProxy = JMX.newMXBeanProxy(mbsc, mbeanNameNewGen, GarbageCollectorMXBean.class, true); GarbageCollectorMXBean oldGenCollectorMXBeanProxy = JMX.newMXBeanProxy(mbsc, mbeanNameOldGen, GarbageCollectorMXBean.class, true); // Create the notification isteners ClientListener newListener = new ClientListener(); ClientListener oldListener = new ClientListener(); // Add notification listeners for the MXBeans mbsc.addNotificationListener(mbeanNameNewGen, newListener, null, null); mbsc.addNotificationListener(mbeanNameOldGen, oldListener, null, null); nap(20000000); } private static void nap(int millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); } } }
GCDetails
for Detailed Collection Metrics
getLastGCDetails()
returns a GCDetails
object that
contains detailed information about the last previously completed garbage collection
including details about the pause times and memory pool sizes.
Two methods enable easy monitoring of the wall clock time this collector
is using and the pause times required to complete collections
for this collector:
getCollectorCumulativeRunningTimeSec()
getCollectorCumulativePauseTimeSec()
Control over the time interval of the collection of data in the
two cumulative counters used internally in the Java virtual machine
is provided by methods to reset the cumulative counters and query
when the last reset occurred:
resetCollectorCumulativeCounters()
getTimeOfLastResetCollectorCumulativeCounters()
getCollectorMaxPauseDetails()
returns an array of
PauseDetails
objects, each of which is the maximum pause time for
each of the types of pauses required by the garbage collector to complete a collection.
Control of the time interval over which the maximum pause data is collected
is provided by a method to reset the time to begin
collecting data to the current time and another method to query when the
last reset of the start time occurred:
resetCollectorMaxPauseDetails()
getTimeOfLastResetCollectorMaxPauseDetails()
The following methods provide an interface to the attributes of this collector:
MemoryManagerMXBean.isValid()
- returns whether this is a valid collector
MemoryManagerMXBean.getName()
- returns the name of this collector
MemoryManagerMXBean.getMemoryPoolNames()
- returns the name of the memory pools collected by this collector
getGarbageCollectorThreadCount()
- returns the number of garbage collector threads used by this collector
Information about the number of collections completed, the wall clock times
when they completed and the duration of the collections:
getCollectionCount()
getTimeOfLastCollectionEnd()
getTimeOfPenultimateCollectionEnd()
getDurationOfLastCompletedCollection()
Collector name, collected pools, collection count and times, and compiler thread count
MemoryManagerMXBean.isValid()
MemoryManagerMXBean.getName()
MemoryManagerMXBean.getMemoryPoolNames()
getCollectionCount()
getDurationOfLastCompletedCollection()
getTimeOfLastCollectionEnd()
getTimeOfPenultimateCollectionEnd()
getGarbageCollectorThreadCount()
Cumulative counters for collection and pause times and reset of counters
getCollectorCumulativePauseTimeSec()
getCollectorCumulativeRunningTimeSec()
resetCollectorCumulativeCounters()
getTimeOfLastResetCollectorCumulativeCounters()
Percentage of time collector is running, maximum and reset
getPercentageOfTimeCollectorIsRunning()
getHighestPercentageOfTimeCollectorIsRunning()
resetHighestPercentageOfTimeCollectorIsRunning()
getTimeOfLastResetHighestPercentageOfTimeCollectorIsRunning()
Pauses required by the collector to do its work, maximums and reset
getCollectorMaxPauseDetails()
returns an array of PauseDetails
objects
resetCollectorMaxPauseDetails()
getTimeOfLastResetCollectorMaxPauseDetails()
Collection details - diagnostics, memory pool sizes and pause times
getLastGCDetails()
returns a GCDetails
object
Thresholds and notifications
Percentage of time collector is running threshold
setPercentageOfTimeCollectorIsRunningThreshold(double)
getPercentageOfTimeCollectorIsRunningThreshold()
getPercentageOfTimeCollectorIsRunningThresholdExceededCount()
isPercentageOfTimeCollectorIsRunningThresholdExceeded()
Collection pause duration threshold
setGarbageCollectionPauseDurationThreshold(double)
getGarbageCollectionPauseDurationThreshold()
getGarbageCollectionPauseDurationThresholdExceededCount()
isGarbageCollectionPauseDurationThresholdExceeded()
Collection duration threshold
setGarbageCollectionDurationThreshold(double)
getGarbageCollectionDurationThreshold()
getGarbageCollectionDurationThresholdExceededCount()
isGarbageCollectionDurationThresholdExceeded()
Interval to wait before sending another notification when a threshold is constantly exceeded
setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded(long)
getIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded()
Modifier and Type | Method and Description |
---|---|
long |
getCollectionCount()
Collection count for this collector.
|
double |
getCollectorCumulativePauseTimeSec()
Cumulative pause time required by this collector to do its collections.
|
double |
getCollectorCumulativeRunningTimeSec()
Cumulative wall clock running time for this collector.
|
PauseDetails[] |
getCollectorMaxPauseDetails()
Max pause time details for this collector.
|
double |
getDurationOfLastCompletedCollection()
Duration of the last completed collection for this collector.
|
double |
getGarbageCollectionDurationThreshold()
Returns the threshold value at or above which the garbage collection
duration threshold exceeded count will be incremented when the
collection duration for a garbage collection performed by
this garbage collector exceeds that threshold value.
|
long |
getGarbageCollectionDurationThresholdExceededCount()
Returns the number of times the threshold value for this garbage collector’s
collection duration has been exceeded since the start of the process.
|
double |
getGarbageCollectionPauseDurationThreshold()
Returns the threshold value at or above which the threshold exceeded
count will be incremented when a pause duration for a garbage collector
required pause exceeds that value.
|
long |
getGarbageCollectionPauseDurationThresholdExceededCount()
Returns the number of times the threshold value for the garbage collector
required pauses has been exceeded since the start of the process.
|
int |
getGarbageCollectorThreadCount()
Number of garbage collection threads for this garbage collector.
|
double |
getHighestPercentageOfTimeCollectorIsRunning()
Highest percentage of time this garbage collector has been running.
|
long |
getIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded()
The minimum interval to wait before sending a renotification when the threshold is
continuously exceeded.
|
GCDetails |
getLastGCDetails()
Garbage collector’s garbage collection details.
|
double |
getPercentageOfTimeCollectorIsRunning()
Percentage of wall clock time this collector is running.
|
double |
getPercentageOfTimeCollectorIsRunningThreshold()
Returns the threshold value at or above which a notification will be generated
that the percentage of time this collector has been running has exceeded
the threshold.
|
long |
getPercentageOfTimeCollectorIsRunningThresholdExceededCount()
Returns the number of times the threshold value for the
percentage-of-time-collector-is-running metric
as been exceeded since the start of the process.
|
double |
getTimeOfLastCollectionEnd()
Elapsed time in seconds between the start of the JVM and the completion
of the last previously (most recently) completed garbage collection for this
collector.
|
double |
getTimeOfLastResetCollectorCumulativeCounters()
Time when the collector’s cumulative counters were last reset.
|
double |
getTimeOfLastResetCollectorMaxPauseDetails()
Reset time for highest percentage of time this collector was running.
|
double |
getTimeOfLastResetHighestPercentageOfTimeCollectorIsRunning()
Reset time for the variable holding the value of the highest percentage
of time this collector has been running.
|
double |
getTimeOfPenultimateCollectionEnd()
Elapsed time in seconds between the start of the JVM and the completion of
the penultimate (prior to the last) garbage collection for this collector.
|
java.lang.String |
getVersion()
Version of the GarbageCollectorMXBean application programming interface.
|
boolean |
isGarbageCollectionDurationThresholdExceeded()
Answers the question whether the threshold value for the collection duration
for this garbage collector has been exceeded in the
time interval between the end of the penultimate completed garbage collection
by this collector and the end of the last completed garbage collection by this
collector.
|
boolean |
isGarbageCollectionPauseDurationThresholdExceeded()
Answers the question whether the threshold value for the pause duration
for garbage collector required pauses for this garbage collector has been
exceeded for this garbage collector in the
time interval between the end of the penultimate completed garbage collection
by this collector and the end of the last completed garbage collection by this
collector.
|
boolean |
isPercentageOfTimeCollectorIsRunningThresholdExceeded()
Answers the question whether the threshold value for
percentage-of-time-collector-is-running
has been exceeded for this garbage collector in the
time interval between the end of the penultimate completed garbage collection
by this collector and the end of the last completed garbage collection by this
collector.
|
double |
resetCollectorCumulativeCounters()
Reset this collector’s cumulative counters.
|
double |
resetCollectorMaxPauseDetails()
Reset this collector’s stored max pause time values.
|
double |
resetHighestPercentageOfTimeCollectorIsRunning()
Reset the highest percentage of time this garbage collector has been running
to zero.
|
boolean |
setGarbageCollectionDurationThreshold(double threshold)
Set the upper threshold value used when monitoring the duration of
a garbage collection.
|
boolean |
setGarbageCollectionPauseDurationThreshold(double threshold)
Set the upper threshold value used when monitoring the duration of a
collector required pause.
|
boolean |
setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded(long secondsToWaitBeforeRenotify)
Sets the minimum interval to wait before a renotification when the threshold
is continuously exceeded.
|
boolean |
setPercentageOfTimeCollectorIsRunningThreshold(double threshold)
Set the upper threshold value used when monitoring the percentage-of-time-collector-is-running.
|
getMemoryPoolNames, getName, isValid
long getCollectionCount()
Collection count for this collector.
The number of collections that have been completed by this collector. A
value of -1
means that collection counts are undefined for
this collector.
double getCollectorCumulativePauseTimeSec()
Cumulative pause time required by this collector to do its collections. The approximate cumulative time (in seconds) spent in any type of pauses required by this garbage collector while garbage collecting. The value will be updated after the first and subsequent garbage collections have been completed.
double getCollectorCumulativeRunningTimeSec()
Cumulative wall clock running time for this collector. The approximate, cumulative wall clock time (in seconds) spent in garbage collections that have been completed by this collector. The value will be updated after the first and each subsequent garbage collection has been completed.
PauseDetails[] getCollectorMaxPauseDetails()
Max pause time details for this collector. Returns the maximum pause times for each of the types of the individual safepoint pauses required by this collector to complete a collection. Because there are usually multiple pause times required for a single collection, the values are returned in an array.
double getDurationOfLastCompletedCollection()
Duration of the last completed collection for this collector. The time (in seconds) from the start of the last completed collection to the end of that last completed collection for this collector. The value will be updated after the first and each subsequent garbage collection this collector has completed. Before the completion of the first garbage collection for this collector, the value returned will be 0.0.
double getGarbageCollectionDurationThreshold()
Returns the threshold value at or above which the garbage collection duration threshold exceeded count will be incremented when the collection duration for a garbage collection performed by this garbage collector exceeds that threshold value.
Notifications can be generated if the value is greater than zero.
long getGarbageCollectionDurationThresholdExceededCount()
Returns the number of times the threshold value for this garbage collector’s collection duration has been exceeded since the start of the process.
double getGarbageCollectionPauseDurationThreshold()
Returns the threshold value at or above which the threshold exceeded count will be incremented when a pause duration for a garbage collector required pause exceeds that value.
Notifications can be generated if the value is greater than zero.
long getGarbageCollectionPauseDurationThresholdExceededCount()
Returns the number of times the threshold value for the garbage collector required pauses has been exceeded since the start of the process.
int getGarbageCollectorThreadCount()
Number of garbage collection threads for this garbage collector. Every garbage collector uses a pool of garbage collector threads to perform garbage collections. The number of threads in the thread pool used by this collector is the count returned.
double getHighestPercentageOfTimeCollectorIsRunning()
Highest percentage of time this garbage collector has been running.
The approximate maximum percentage of time, for this collector, that the collector
threads were running while doing a collection over the time interval since the
launch of the JVM or since the last previous reset of this metric.
See getPercentageOfTimeCollectorIsRunning
for an explanation
of the meaning of the underlying metric, the percentage of time the
collector is running.
long getIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded()
The minimum interval to wait before sending a renotification when the threshold is continuously exceeded. The first notification is sent when the conditions are checked and the threshold has been crossed. If, as time continues, the threshold remains continuously exceeded, rather than flooding the system with notifications, no additional notifications are sent. This value represents the minimum number of seconds to wait before renotifying when that threshold is continuously exceeded. If the returned value is zero, no renotifications are generated.
java.lang.UnsupportedOperationException
- if this is not supported.setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded()
for an explanation of the time interval to wait before renotification
when the threshold is continuously exceeded.
GCDetails getLastGCDetails()
Garbage collector’s garbage collection details. Returns details of the state of the JVM in a GCDetails object that contains before and after details about the most recently completed (last) garbage collection for this collector. The returned information includes internal JVM and system information as well as detailed information on the memory pool sizes at the start of the collection and at the end of the collection after the garbage has been collected.
double getPercentageOfTimeCollectorIsRunning()
Percentage of wall clock time this collector is running. For this collector, the approximate percentage of time that this collector’s threads were running and doing a collection over the interval starting when the penultimate collection for this collector completed to the end of the most recently completed (last) collection for this collector. The percentage will only be calculated at the end of the collection after the collection has completed.
Examples:
Time collector is not running: ----- Time collector is running: rrrrr Example of a garbage collector spending 5% of its time collecting: percentage end of end of of time penultimate last running | | 5 % --------------------------------------rr ----- wall clock time ----> Other good percentages that allow time for application threads to work: 10 % ------------------------------------rrrr ----- 20 % --------------------------------rrrrrrrr ----- 30 % ----------------------------rrrrrrrrrrrr ----- Percentages considered too high for good performance (increase -Xmx!): 50 % --------------------rrrrrrrrrrrrrrrrrrrr ----- 90 % ----rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr ----- wall clock time ---->
double getPercentageOfTimeCollectorIsRunningThreshold()
Returns the threshold value at or above which a notification will be generated that the percentage of time this collector has been running has exceeded the threshold. Units are percent of the time that this collector is running rounded to the nearest integer. Valid return values are in the range 0 to 100, inclusive.
getPercentageOfTimeCollectorIsRunning()
for an explanation of the percentage of time the collector is running metric.
long getPercentageOfTimeCollectorIsRunningThresholdExceededCount()
Returns the number of times the threshold value for the percentage-of-time-collector-is-running metric as been exceeded since the start of the process.
getPercentageOfTimeCollectorIsRunning()
for an explanation of the percentage of time the collector is running metric.
double getTimeOfLastCollectionEnd()
Elapsed time in seconds between the start of the JVM and the completion of the last previously (most recently) completed garbage collection for this collector. The value will be updated after the first and each subsequent garbage collection has been completed for this collector. Before completion of the first garbage collection for this collector, the value returned will be 0.0.
double getTimeOfLastResetCollectorCumulativeCounters()
Time when the collector’s cumulative counters were last reset. Units are in seconds and represent the time interval between the launch of the JVM and the last previous reset. When no resets have been performed, the time will be zero, meaning that no resets have been done since the launch of the JVM.
double getTimeOfLastResetCollectorMaxPauseDetails()
Reset time for highest percentage of time this collector was running. The reset time for the variable holding the value of the highest percentage of time this collector has been running. Units are in seconds representing the time interval between the launch of the JVM and the last previous reset.
double getTimeOfLastResetHighestPercentageOfTimeCollectorIsRunning()
Reset time for the variable holding the value of the highest percentage
of time this collector has been running.
Units are in seconds representing the time interval between the launch of
the JVM and the last previous reset or zero if no resets have been done.
See getPercentageOfTimeCollectorIsRunning
,
getHighestPercentageOfTimeCollectorIsRunning
and resetHighestPercentageOfTimeCollectorIsRunning
for an explanation of the metric.
double getTimeOfPenultimateCollectionEnd()
Elapsed time in seconds between the start of the JVM and the completion of the penultimate (prior to the last) garbage collection for this collector. The value will be updated after the second and each subsequent garbage collection for this collector has completed. Before the second garbage collection for this collector has completed, the value returned will be 0.0.
java.lang.String getVersion()
Version of the GarbageCollectorMXBean application programming interface. The format for the version is majorVersion.minorVersion.microVersion.
getVersion
in interface MemoryManagerMXBean
boolean isGarbageCollectionDurationThresholdExceeded()
Answers the question whether the threshold value for the collection duration for this garbage collector has been exceeded in the time interval between the end of the penultimate completed garbage collection by this collector and the end of the last completed garbage collection by this collector.
boolean isGarbageCollectionPauseDurationThresholdExceeded()
Answers the question whether the threshold value for the pause duration for garbage collector required pauses for this garbage collector has been exceeded for this garbage collector in the time interval between the end of the penultimate completed garbage collection by this collector and the end of the last completed garbage collection by this collector.
boolean isPercentageOfTimeCollectorIsRunningThresholdExceeded()
Answers the question whether the threshold value for percentage-of-time-collector-is-running has been exceeded for this garbage collector in the time interval between the end of the penultimate completed garbage collection by this collector and the end of the last completed garbage collection by this collector.
getPercentageOfTimeCollectorIsRunning()
for an explanation of the percentage of time the collector is running metric.
double resetCollectorCumulativeCounters()
Reset this collector’s cumulative counters.
Resets to zero the cumulative counters for the
getCollectorCumulativeRunningTimeSec
and
getCollectorCumulativePauseTimeSec
metrics.
java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.double resetCollectorMaxPauseDetails()
Reset this collector’s stored max pause time values. Resets the value of the max pause time for each of the individual types of pauses for this collector. The value of each pause type is reset to the PauseDetails value for the last previously completed collection for that type of pause.
java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.double resetHighestPercentageOfTimeCollectorIsRunning()
Reset the highest percentage of time this garbage collector has been running
to zero.
Resets the stored, historical value of the highest percentage of time this
collector has been running to zero to more easily track periods when you
want to monitor the highest percentage over a shorter interval of time.
See getPercentageOfTimeCollectorIsRunning
and getHighestPercentageOfTimeCollectorIsRunning
for an explanation of the metric being reset. Resetting while a collection
is in progress will reset the value to zero.
java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.boolean setGarbageCollectionDurationThreshold(double threshold)
Set the upper threshold value used when monitoring the duration of a garbage collection. When the measured collection duration (wall clock time) for this collector is equal to or exceeds the specified threshold then the garbage collection duration threshold exceeded count for this collector will be incremented. Units for the threshold are seconds of time that from the start of a collection for this garbage collector to the end of the same collection for this collector. The default threshold value is zero.
Set to a value greater than zero to enable listeners to receive notifications for events when the threshold is crossed.
threshold
- value at or above which the garbage collection duration
threshold exceeded count for this collector will
be incremented and, if there are listeners, a notification will
be generated.true
if the operation is successful; else false
java.lang.IllegalArgumentException
- if the new threshold
is either negative or greater than the maximum allowed.java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.boolean setGarbageCollectionPauseDurationThreshold(double threshold)
Set the upper threshold value used when monitoring the duration of a collector required pause. When the measured duration of a pause required by the collector is equal to or exceeds the specified threshold then this garbage collector’s pause duration threshold exceeded count will be incremented. Units for the threshold are seconds of time that the collector is paused. The default threshold value is zero.
Set to a value greater than zero to enable listeners to receive notifications for events when the threshold is reached or crossed.
threshold
- value at or above which this garbage collector’s pause
duration threshold exceeded count will
be incremented and, if there are listeners, a notification will
be generated (units are seconds).true
if the operation is successful; else false
java.lang.IllegalArgumentException
- if the new threshold
is either negative or greater than the maximum allowed.java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.boolean setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded(long secondsToWaitBeforeRenotify)
Sets the minimum interval to wait before a renotification when the threshold
is continuously exceeded. The first notification is sent when the conditions
are checked and the threshold has been crossed. If, as time continues, the threshold
remains continuously exceeded, rather than flooding the system with notifications, no
additional notifications are sent.
However, the
setIntervalToWaitBeforeRenotifyWhenThresholdContinuouslyExceeded
can
be set to a time interval that, measured from the time of the previous notification, would cause
a renotification to be sent when the threshold is continuously exceeded. If the
renotification is sent then the timer starts again at that time to determine
when the next time interval will be exceeded. Use of this feature does not guarantee that
renotifications will occur at the interval specified because the check for the
resource’s exceeding of the threshold may only occur at an interval longer than
the value of the parameter supplied.
The default value is 0 and, when set to that value, means that no renotifications
will be generated.
secondsToWaitBeforeRenotify
- The minimum interval to wait in seconds before a renotification.true
when successful execution,
otherwise false
.java.lang.IllegalArgumentException
- if the new secondsToWaitBeforeRenotify
is either negative or greater than the maximum allowed.java.lang.UnsupportedOperationException
- if this is not supported.java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.boolean setPercentageOfTimeCollectorIsRunningThreshold(double threshold)
Set the upper threshold value used when monitoring the percentage-of-time-collector-is-running. When the percentage-of-time-collector-is-running metric for this collector is equal to or exceeds the specified threshold then this garbage collector’s count of the number of times the percentage-of-time-collector-is-running metric has exceeded the threshold will be incremented.
Units are percentage-of-the-time-collector-is-running rounded to the nearest integer. Valid values are in the range 0 to 100, inclusive. The default threshold value is zero.
If the value set is above zero then notifications of threshold crossings are also available to listeners.
threshold
- value at or above which the threshold exceeded counter
will be incremented. If greater than zero then enables listeners to monitor
notifications generated when the value is equal to or exceeds the threshold.true
if the operation is successful; else false
java.lang.IllegalArgumentException
- if the new threshold
is either negative or greater than one hundred.java.lang.SecurityException
- if caller does not have
ManagementPermission("control")
.getPercentageOfTimeCollectorIsRunning()
for an explanation of the percentage of time the collector is running metric.
Submit a bug or feature request
Copyright © 2015-2017, Azul Systems, Inc. All rights reserved.
Azul Systems and Zing are registered trademarks of Azul Systems, Inc.