Skip to content

Commit

Permalink
support concurrent GC events for G1 (#1051)
Browse files Browse the repository at this point in the history
In JDK20 a new mbean has been added for tracking the
concurrent phases of G1. Update the check to correctly
attribute this as a concurrent phase.
  • Loading branch information
brharrington committed Apr 6, 2023
1 parent d823fde commit fc1c4ba
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,13 @@ private boolean isConcurrentPhase(GarbageCollectionNotificationInfo info) {
//
// For ZGC in older versions, there is no way to accurately get the amount of time
// in STW pauses.
return "No GC".equals(info.getGcCause()) // CMS
|| info.getGcName().endsWith(" Cycles"); // Shenandoah, ZGC
//
// For G1, a new bean was added in JDK20 to indicate time spent in concurrent
// phases:
// https://bugs.openjdk.org/browse/JDK-8297247
return "No GC".equals(info.getGcCause()) // CMS
|| "G1 Concurrent GC".equals(info.getGcName()) // G1 in JDK20+
|| info.getGcName().endsWith(" Cycles"); // Shenandoah, ZGC
}

private class GcNotificationListener implements NotificationListener {
Expand Down

0 comments on commit fc1c4ba

Please sign in to comment.