On Tue, 28 Oct 2025 01:17:57 GMT, Mat Carter <[email protected]> wrote:

> Add jdk.management.AOTCacheMXBean. The interface provides a single action 
> that when called will cause any hosted JVM currently recording AOT 
> information will stop recording. Existing functionality is preserved: when 
> stopped the JVM will create the required artifacts based on the execution 
> mode. Conveniently as the application running on the JVM has not stopped (as 
> was previously the only way to stop recording), the application will resume 
> execution after the artifacts have been generated.
> 
> The interface will return TRUE if a recording was successfully stopped, in 
> all other cases (not recording etc.) will return FALSE
> 
> It follows that invoking the action on a JVM that is recording, twice in 
> succession, should (baring internal errors) produce the following two 
> responses:
> 
> TRUE
> FALSE
> 
> Passes tier1 on linux (x64) and windows (x64)

src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line 
29:

> 27: import java.lang.management.ManagementFactory;
> 28: import java.lang.management.PlatformManagedObject;
> 29: import java.util.concurrent.ForkJoinPool;

I assume there is no need to import ForkJoinPool.

src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line 
36:

> 34:  * Management interface for the JDK's Ahead of Time (AOT) optimizations.
> 35:  *
> 36:  * Currently, {@code HotSpotAOTCacheMXBean} defines one operation at this 
> time to end the AOT recording.

I think you drop "Currently, ", it will be a bit clearer without it.

test/hotspot/jtreg/runtime/cds/appcds/aotCache/HotSpotAOTCacheMXBeanTest.java 
line 98:

> 96:     public static void main(String[] args) {
> 97:         System.out.println("Hello Leyden " + args[0]);
> 98:         var aotBean = 
> ManagementFactory.getPlatformMXBean(HotSpotAOTCacheMXBean.class);

This uses MF.getPlatformMXBean in the child VM. A more complete test would 
repeat with:

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        HotSpotAOTCacheMXBean bean = 
ManagementFactory.newPlatformMXBeanProxy(server,
                "jdk.management:type=HotSpotAOTCacheMXBean",
                HotSpotAOTCacheMXBean.class);


In any case, it might be simpler to test that the MXBean is registered in the 
test itself, it doesn't need to be in the child VM.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2468799292
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2468801255
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2468824691

Reply via email to