1 /*
2 * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package jdk.management;
26
27 import java.lang.management.ManagementFactory;
28 import java.lang.management.PlatformManagedObject;
29 import java.util.concurrent.ForkJoinPool;
30 import javax.management.MBeanServer;
31 import javax.management.ObjectName;
32
33 /**
34 * Management interface for the JDK's AOT system.
35 *
36 * <p> {@code AOTCacheMXBean} supports inspection of the current AOT mode, as well as monitoring
37 * the current recording length. It also supports dynamically ending the current recording.
38 *
39 * <p> The management interface is registered with the platform {@link MBeanServer
40 * MBeanServer}. The {@link ObjectName ObjectName} that uniquely identifies the management
41 * interface within the {@code MBeanServer} is: "jdk.management:type=AOTCache".
42 *
43 * <p> Direct access to the MXBean interface can be obtained with
44 * {@link ManagementFactory#getPlatformMXBean(Class)}.
45 *
46 * @since 26
47 */
48 public interface AOTCacheMXBean extends PlatformManagedObject {
49 /**
50 * Returns the string representing the current AOT mode of
51 * operation.
52 *
53 * @return the string representing the current AOT mode.
54 */
55 public String getMode();
56
57 /**
58 * Tests if a recording is in progress.
59 *
60 * @return {@code true} if a recording is in progress; {@code false} otherwise.
61 */
62 public boolean isRecording();
63
64 /**
65 * If a recording is in progress or has been completed, then returns the duration in milliseconds
66 *
67 * @return duration of the recording in milliseconds.
68 */
69 public long getRecordingDuration();
70
71 /**
72 * If a recording is in progress, then ends the recording.
73 *
74 * @return {@code true} if a recording was stopped; {@code false} otherwise.
75 */
76 public boolean endRecording();
77 }