Add info contributor support for JDK 24's VirtualThreadSchedulerMXBean#43594
Conversation
philwebb
left a comment
There was a problem hiding this comment.
Thanks very much for the PR. I've added some review comments for your consideration.
I think we could add something to the existing test just to check that we have sensible(ish) values. |
6edc540 to
d898b44
Compare
d898b44 to
1f1b9b8
Compare
|
Thank you very much and congratulations on your first contribution 🎉! |
|
Since reflection is being used here, I wonder whether static class ProcessInfoContributorRuntimeHints implements RuntimeHintsRegistrar {
private final BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar();
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
this.bindingRegistrar.registerReflectionHints(hints.reflection(), ProcessInfo.class);
hints.reflection()
.registerTypeIfPresent(classLoader, "jdk.management.VirtualThreadSchedulerMXBean",
MemberCategory.INVOKE_PUBLIC_METHODS);
}
} |
|
Yeah, good catch. I'll add that. |
|
For some reason after upgrading to Spring Boot v4, we started to see a lot of errors in our actuator endpoint. It started out first with So I added the required hins via running the tracing agent. I use native image with jdc ce 25. For some reason |
|
@cmdjulian Could you please open a new issue and provide a sample application that replicates the problem. |
In this commit, for applications using Spring with JDK 24, I added support for viewing Virtual threads information in
ProcessInfousingVirtualThreadSchedulerMXBean. The use ofVirtualThreadSchedulerMXBeanis done using reflection. If the current JDK version is less than 24, then we will return null, otherwise a class with all the requiredVirtualThreadsInfoinformation.I also added a test checking if null is returned if the JDK version is less than 24.
There is also a point that bothers me, do you think we need an additional test to check the values of the
VirtualThreadsInfofields themselves or not?Related to #43175