Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info contributor support for JDK 24's VirtualThreadSchedulerMXBean #43175

Closed
mhalbritter opened this issue Nov 15, 2024 · 4 comments
Closed
Assignees
Labels
status: superseded An issue that has been superseded by another

Comments

@mhalbritter
Copy link
Contributor

image

Maybe we can fit these information into the existing ProcessInfo.

@mhalbritter mhalbritter added the type: enhancement A general enhancement label Nov 15, 2024
@mhalbritter mhalbritter added this to the 3.x milestone Nov 15, 2024
@panic08
Copy link

panic08 commented Dec 16, 2024

I am very interested in this issue and would like to ask a couple questions.

  1. Do I understand correctly that we want to put such fields into ProcessInfo in this form?
private final Long mountedVirtualThreadCount;

private final Long queuedVirtualThreadCount;

private final Integer parallelism;

private final Integer poolSize;
  1. Am I right that we should use reflection to work safely with VirtualThreadSchedulerMXBean since it is jdk 24? Use something like
@SuppressWarnings(“unchecked”)
Class<? extends PlatformManagedObject> clazz = (Class<? extends PlatformManagedObject>)
	Class.forName(“jdk.management.VirtualThreadSchedulerMXBean”);

Object mxBean = ManagementFactory.getPlatformMXBean(clazz);

and then also call methods to get the fields we need

@mhalbritter
Copy link
Contributor Author

mhalbritter commented Dec 17, 2024

Hello,

I'd add a new field to ProcessInfo: private final VirtualThreads virtualThreads;. This field could be null if running on Java < 24.

public static class VirtualThreads {

    private final long mounted;

    private final long queued;

    private final int parallelism;

    private final int poolSize;

}
  1. Am I right that we should use reflection to work safely with VirtualThreadSchedulerMXBean since it is jdk 24?

Yes. Another option would be a multi-release JAR, but I don't think we have the infrastructure for that in place. I'd go for reflection here.

Should I assign you to the issue?

@panic08
Copy link

panic08 commented Dec 17, 2024

Should I assign you to the issue?

Yeah, that'd be cool

@philwebb
Copy link
Member

Closing in favor of PR #43594. Thanks @panic08!

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2024
@philwebb philwebb added status: superseded An issue that has been superseded by another and removed type: enhancement A general enhancement labels Dec 23, 2024
@philwebb philwebb removed this from the 3.x milestone Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

No branches or pull requests

3 participants