Handle possible ThreadMXBean findDeadlockedThreads UnsupportedOperationException
dhoard opened this issue · comments
While testing the JMX Exporter against the latest JVM versions...
It seems that azul/prime:8
, azul/prime:11
, and azul/prime:17
have changed behavior and no longer support findDeadlockedThreads
, throwing an UnsupportedOperationException
java.lang.UnsupportedOperationException: Monitoring of Synchronizer Usage is not supported.
at java.management/sun.management.ThreadImpl.findDeadlockedThreads(ThreadImpl.java:431)
at io.prometheus.jmx.shaded.io.prometheus.client.hotspot.ThreadExports.addThreadMetrics(ThreadExports.java:98)
at io.prometheus.jmx.shaded.io.prometheus.client.hotspot.ThreadExports.collect(ThreadExports.java:175)
at io.prometheus.jmx.shaded.io.prometheus.client.hotspot.ThreadExports.collect(ThreadExports.java:169)
This exists in the pre-1.0.0 code, but will also cause issues in the 1.0.0 code.
The code below needs to be changed to handle such scenarios since the JVM is not required to support findDeadlockedThreads