-
CSR
-
Resolution: Unresolved
-
P3
-
None
-
minimal
-
New interface, no compatibility impact.
-
Java API
-
JDK
Summary
Introduce a new JDK-specific monitoring and management interface named jdk.management.HotSpotAOTCacheMXBean.java to manage the creation of the AOT cache.
Problem
There is currently no tooling support for AOT cache creation that can be accessed from the Java application. The command-line option -XX:AOTCacheOutput creates the cache only when the current JVM exits. This is not suitable for application that never exits, or for applications that want to create the AOT cache before the JVM exits.
Solution
Add management interface jdk.management.HotSpotAOTCacheMXBean to the jdk.management module.
Specification
package jdk.management;
import java.lang.management.ManagementFactory;
import java.lang.management.PlatformManagedObject;
import java.util.concurrent.ForkJoinPool;
import javax.management.MBeanServer;
import javax.management.ObjectName;
/**
* Management interface for the JDK's Ahead of Time (AOT) optimizations.
*
* Currently, {@code HotSpotAOTCacheMXBean} defines one operation at this time to end the AOT recording.
* More operations and/or properties may be added in a future release.
*
* <p> The management interface is registered with the platform {@link MBeanServer
* MBeanServer}. The {@link ObjectName ObjectName} that uniquely identifies the management
* interface within the {@code MBeanServer} is: "jdk.management:type=HotSpotAOTCache".
*
* <p> Direct access to the MXBean interface can be obtained with
* {@link ManagementFactory#getPlatformMXBean(Class)}.
*
* @since 26
*/
public interface HotSpotAOTCacheMXBean extends PlatformManagedObject {
/**
* If an AOT recording is in progress, ends the recording. This operation completes
* after the AOT artifacts have been completely written.
*
* <p>The JVM will start recording AOT artifacts upon start-up if certain JVM options are
* given in the command-line. The recording will stop when the JVM exits, or when
* the {@code endRecording} method is called. Examples:
*
* <p> java -XX:AOTCacheOutput=app.aot ....
*
* <blockquote>
* The JVM will record optimization information about the current application
* into the AOT cache file app.aot. In a future execution of this application,
* -XX:AOTCache=app.aot can be provided to improve the application's
* start-up and warm-up performance.
* </blockquote>
*
* <p> java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconfig ....
*
* <blockquote>
* The JVM will record optimization information about the current application
* into the AOT configuration file app.aotconfig. Subsequently, an AOT cache
* file can be created with the command:
*
* <p>java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconfig -XX:AOTCache=app.aot ...
* <blockquote>
*
* <p>For more information about creating and using the AOT artifacts, and detailed
* specification of the corresponding JVM command-line options, please refer
* to https://openjdk.org/jeps/483 and https://openjdk.org/jeps/514.
*
* <p>Note: Currently there are no APIs to start an AOT recording. AOT recordings must be
* started using JVM command-line options such as -XX:AOTCacheOutput.
*
* <p> There are also no APIs to querying whether the AOT recording is in progress, or what AOT
* artifacts are being recorded. If such information is required by the application, it should be passed
* to the application via system properties or command-line arguments. For example:
*
* <p> java -XX:AOTCacheOutput=app.aot -Dmyapp.cache.output=app.aot -jar myapp.jar MyApp
*
* <blockquote>
* The application can contain logic like the following. Note that it's possible
* to access the AOT cache file using regular file I/O APIs after the endRecording() function
* has returned {@code true}.
* <pre>
* {@code
* HotSpotAOTCacheMXBean bean = ....;
* String aotCache = System.getProperty("myapp.cache.output");
* if (aotCache != null) {
* System.out.println("JVM is recording into " + aotCache);
* performSomeActionsThatNeedsToBeRecorded();
* if (bean.endRecording()) {
* System.out.println("Recording is successfully finished: " + aotCache);
* }
* }</pre>
* </blockquote>
*
* @return {@code true} if a recording was in progress and has been ended successfully; {@code false} otherwise.
*/
public boolean endRecording();
}
- csr of
-
JDK-8369736 Add management interface for AOT cache creation
-
- Open
-