On Thu, 5 Sep 2024 17:54:46 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> This PR proposes to add a JDK-specific monitoring and management interface 
>> for the virtual thread scheduler. The interface is named 
>> [VirtualThreadSchedulerMXBean](https://download.java.net/java/early_access/loom/docs/api/jdk.management/jdk/management/VirtualThreadSchedulerMXBean.html)
>>  and allows JMX based tooling monitor/manage the scheduler's target 
>> parallelism and monitor thread counts.
>> 
>> The JDK 5/6 era JDK-specific management interfaces are in 
>> jdk.management/com.sun.management. The proposal here is to start afresh in 
>> the jdk.management package, thus establishing a "new home" for JDK-specific 
>> management interfaces going forward.
>> 
>> jdk.test.lib.thread.VThreadRunner is test infrastructure used by several 
>> tests to set or ensure some level of parallelism. This is changed from using 
>> deep reflection to using the MXBean to access the target parallelism, which 
>> requires changes to the `@modules` tag tests in a number of tests (some 
>> tests no longer need to open java.base/java.lang).
>> 
>> (The changes proposed here have been in the loom repo for some time. A 
>> related command for the jcmd tool is also in that repo and will be proposed 
>> separately).
>
> Alan Bateman has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Sync up from loom repo
>  - Merge
>  - Sync up from loom repo
>  - Merge
>  - Sync up from loom repo
>  - Initial commit

This all looks good to me, good to have the info and control available via JMX.
jdk.management looks like the right home.


The ObjectName String "jdk.management:type=VirtualThreadScheduler" could have a 
public static final definition somewhere in future, but there is no obvious 
home, e.g. java.lang.management.ManagementFactory is in the wrong package.  
Something for the future, not for this change, as I others that don't have such 
a symbol.

src/jdk.management/share/classes/jdk/management/VirtualThreadSchedulerMXBean.java
 line 34:

> 32: 
> 33: /**
> 34:  * Management interface for the JDK's {@linkplain Thread##virtual-threads 
> virtual thread}

is this "Management interface for **a**" virtual thread scheduler, as in future 
it may be the interface generically for virtual thread schedulers?

-------------

Marked as reviewed by kevinw (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20816#pullrequestreview-2285923893
PR Review Comment: https://git.openjdk.org/jdk/pull/20816#discussion_r1746924898

Reply via email to