# Interface HotSpotAOTCacheMXBean

All Superinterfaces:
  `PlatformManagedObject`

public interface HotSpotAOTCacheMXBean extends PlatformManagedObject
Management interface for the JDK's Ahead of Time (AOT) Cache.

The management interface is registered with the platform `MBeanServer`. The `ObjectName` that uniquely identifies the management interface within the `MBeanServer` is `jdk.management:type=HotSpotAOTCache`.

Direct access to the MXBean interface can be obtained with `ManagementFactory.getPlatformMXBean(Class)`.

Since:
  26

## Method Summary

Modifier and Type
Method
Description
`boolean`
`endRecording()`
If an AOT recording is in progress, ends the recording.

### Methods declared in interface PlatformManagedObject

`getObjectName`
Modifier and Type
Method
Description
`ObjectName`
`getObjectName()`
Returns an `ObjectName` instance representing the object name of this platform managed object.

## Method Details

### endRecording

boolean endRecording()
If an AOT recording is in progress, ends the recording. This method returns after the AOT artifacts have been completely written.

The JVM will start recording AOT artifacts upon start-up if appropriate JVM options are given in the command-line. The recording will stop when the JVM exits, or when the `endRecording` method is called. Examples:

$`java -XX:AOTCacheOutput=app.aot ....`

> The JVM records optimization information for the current application in the AOT cache file `app.aot`. In a future run of the application, the option `-XX:AOTCache=app.aot` will cause the JVM to use the cache to improve the application's startup and warmup performance.

$`java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconfig ....`

> The JVM records optimization information for the current application in the AOT configuration file `app.aotconfig`. Subsequently, an AOT cache file can be created with the command:

> $`java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconfig -XX:AOTCache=app.aot ...`

For more information about creating and using the AOT artifacts, and detailed specification of the corresponding JVM command-line options, please refer to JEP 483 and JEP 514.

Currently there are no APIs to start an AOT recording. AOT recordings must be started using JVM command-line options such as `-XX:AOTCacheOutput`. There are also no APIs to query whether an AOT recording is in progress, or what AOT artifacts are being recorded.

This method enables an application to end its own AOT recording programatically, but that is not necessarily the best approach. Doing so requires changing the application’s code, which might not be feasible. Even when it is feasible, injecting training-specific logic into the application reduces the similarity between training runs and production runs, potentially making the AOT cache less effective. It may be better to arrange for an external agent to end the training run, thereby creating an AOT cache without interfering with the application’s code.

Returns:
  `true` if a recording was in progress and has been ended successfully; `false` otherwise.