Skip to content

Commit 970685e

Browse files
authored
Catch IllegalArgumentException in VirtualThreadMetrics (#6584)
IllegalArgumentException may be thrown by ManagementFactory#getPlatformMXBean() in case if is not a platform management interface or not a singleton platform MXBean. Signed-off-by: Alexey Genus <[email protected]>
1 parent fd340e5 commit 970685e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

micrometer-java21/src/main/java/io/micrometer/java21/instrument/binder/jdk/VirtualThreadMetrics.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ private void bindVirtualThreadSchedulerMXBean(MeterRegistry registry) {
121121
.description(LIVE_THREADS_DESCRIPTION)
122122
.register(registry);
123123
}
124-
catch (ClassNotFoundException | ClassCastException | NoSuchMethodException | IllegalAccessException ignored) {
124+
catch (ClassNotFoundException | ClassCastException | NoSuchMethodException | IllegalAccessException
125+
| IllegalArgumentException ignored) {
125126
// cannot instrument VirtualThreadSchedulerMXBean
126127
}
127128
}

0 commit comments

Comments
 (0)