xvrl commented on a change in pull request #8397: fix JVMMonitor initialization
with JDK11
URL: https://github.com/apache/incubator-druid/pull/8397#discussion_r317393066
##########
File path:
core/src/main/java/org/apache/druid/java/util/metrics/JvmMonitor.java
##########
@@ -146,7 +151,25 @@ private void emitDirectMemMetrics(ServiceEmitter emitter)
private void emitGcMetrics(ServiceEmitter emitter)
{
- gcCounters.emit(emitter, dimensions);
+ if (gcCounters != null) {
+ gcCounters.emit(emitter, dimensions);
+ }
+ }
+
+ @Nullable
+ private GcCounters getGcCounters()
+ {
+ try {
+ return new GcCounters();
+ }
+ catch (RuntimeException e) {
+ // in JDK11 jdk.internal.perf.Perf is not accessible, unless
+ // --add-exports java.base/jdk.internal.perf=ALL-UNNAMED is set
+ log.warn(e, "Cannot initialize GC counters. If running JDK11 and above,"
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]