Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java
12511 views
1
/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/
2
/*
3
*******************************************************************************
4
* Copyright (c) 2005, 2022 IBM Corp. and others
5
*
6
* This program and the accompanying materials are made available under
7
* the terms of the Eclipse Public License 2.0 which accompanies this
8
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
9
* or the Apache License, Version 2.0 which accompanies this distribution and
10
* is available at https://www.apache.org/licenses/LICENSE-2.0.
11
*
12
* This Source Code may also be made available under the following
13
* Secondary Licenses when the conditions for such availability set
14
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
15
* General Public License, version 2 with the GNU Classpath
16
* Exception [1] and GNU General Public License, version 2 with the
17
* OpenJDK Assembly Exception [2].
18
*
19
* [1] https://www.gnu.org/software/classpath/license.html
20
* [2] http://openjdk.java.net/legal/assembly-exception.html
21
*
22
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
23
*******************************************************************************/
24
package java.lang.management;
25
26
import java.security.AccessController;
27
import java.security.PrivilegedAction;
28
import java.util.List;
29
import java.util.Map;
30
31
/**
32
* The management and monitoring interface for the runtime system of the virtual
33
* machine.
34
* <p>
35
* Precisely one instance of this interface will be made available to management
36
* clients.
37
* </p>
38
* <p>
39
* Accessing this <code>MXBean</code> can be done in one of three ways.
40
* <ol>
41
* <li>Invoking the static ManagementFactory.getRuntimeMXBean() method.</li>
42
* <li>Using a javax.management.MBeanServerConnection.</li>
43
* <li>Obtaining a proxy MXBean from the static
44
* {@link ManagementFactory#newPlatformMXBeanProxy} method, passing in
45
* &quot;java.lang:type=Runtime&quot; for the value of the second parameter.
46
* </li>
47
* </ol>
48
*
49
* @since 1.5
50
*/
51
/*[IF JAVA_SPEC_VERSION >= 17]*/
52
@SuppressWarnings("removal")
53
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
54
public interface RuntimeMXBean extends PlatformManagedObject {
55
56
/**
57
* If bootstrap class loading is supported by the virtual machine, returns a
58
* string containing the full bootstrap class path used by the boot class
59
* loader to locate and load class files.
60
* <p>
61
* An indication of whether or not the virtual machine supports a boot class
62
* loader mechanism can be found from invoking the
63
* {@link #isBootClassPathSupported()} method.
64
* </p>
65
*
66
* @return the bootstrap classpath with each entry separated by the path
67
* separator character corresponding to the underlying operating
68
* system.
69
* @throws UnsupportedOperationException
70
* if the virtual machine does not support boot class loading.
71
* @throws SecurityException
72
* if there is a security manager in effect and the caller does
73
* not have {@link ManagementPermission} of &quot;monitor&quot;.
74
*/
75
public String getBootClassPath();
76
77
/**
78
* Returns the class path string used by the system class loader to locate
79
* and load class files. The value is identical to that which would be
80
* obtained from a call to {@link System#getProperty(java.lang.String)}
81
* supplying the value &quot;java.class.path&quot; for the key.
82
*
83
* @return the system classpath with each entry separated by the path
84
* separator character corresponding to the underlying operating
85
* system.
86
* @throws SecurityException
87
* if there is a security manager in operation and the caller
88
* does not have permission to check system properties.
89
* @see System#getProperty(java.lang.String)
90
*/
91
public String getClassPath();
92
93
/**
94
* Returns a list of all of the input arguments passed to the virtual
95
* machine on start-up. This will <i>not </i> include any input arguments
96
* that are passed into the application's <code>main(String[] args)</code>
97
* method.
98
*
99
* @return a list of strings, each one containing an argument to the virtual
100
* machine. If no virtual machine arguments were passed in at
101
* start-up time then this will be an empty list.
102
*/
103
public List<String> getInputArguments();
104
105
/**
106
* Returns the Java library path that will be used by the virtual machine to
107
* locate and load libraries. The value is identical to that which would be
108
* obtained from a call to {@link System#getProperty(java.lang.String)}
109
* supplying the value &quot;java.library.path&quot; for the key.
110
*
111
* @return the Java library path with each entry separated by the path
112
* separator character corresponding to the underlying operating
113
* system.
114
* @throws SecurityException
115
* if there is a security manager in operation and the caller
116
* does not have permission to check system properties.
117
* @see System#getProperty(java.lang.String)
118
*/
119
public String getLibraryPath();
120
121
/**
122
* Returns a string containing the management interface specification
123
* version that the virtual machine meets.
124
*
125
* @return the version of the management interface specification adhered to
126
* by the virtual machine.
127
*/
128
public String getManagementSpecVersion();
129
130
/**
131
* Returns the string name of this virtual machine. This value may be
132
* different for each particular running virtual machine.
133
*
134
* @return the name of this running virtual machine.
135
*/
136
public String getName();
137
138
/*[IF JAVA_SPEC_VERSION >= 10]*/
139
/**
140
* Returns the process ID (PID) of the current running Java virtual machine.
141
*
142
* @return the process ID of the current running JVM
143
*
144
* @since 10
145
*/
146
@SuppressWarnings("boxing")
147
default long getPid() {
148
return AccessController.doPrivileged(new PrivilegedAction<Long>() {
149
public Long run() {
150
return ProcessHandle.current().pid();
151
}
152
});
153
}
154
/*[ENDIF] JAVA_SPEC_VERSION >= 10 */
155
156
/**
157
* Returns the name of the Java virtual machine specification followed by
158
* this virtual machine. The value is identical to that which would be
159
* obtained from a call to {@link System#getProperty(java.lang.String)}
160
* supplying the value &quot;java.vm.specification.name&quot; for the key.
161
*
162
* @return the name of the Java virtual machine specification.
163
* @throws SecurityException
164
* if there is a security manager in operation and the caller
165
* does not have permission to check system properties.
166
* @see System#getProperty(java.lang.String)
167
*/
168
public String getSpecName();
169
170
/**
171
* Returns the name of the Java virtual machine specification vendor. The
172
* value is identical to that which would be obtained from a call to
173
* {@link System#getProperty(java.lang.String)} supplying the value
174
* &quot;java.vm.specification.vendor&quot; for the key.
175
*
176
* @return the name of the Java virtual machine specification vendor.
177
* @throws SecurityException
178
* if there is a security manager in operation and the caller
179
* does not have permission to check system properties.
180
* @see System#getProperty(java.lang.String)
181
*/
182
public String getSpecVendor();
183
184
/**
185
* Returns the name of the Java virtual machine specification version. The
186
* value is identical to that which would be obtained from a call to
187
* {@link System#getProperty(java.lang.String)} supplying the value
188
* &quot;java.vm.specification.version&quot; for the key.
189
*
190
* @return the Java virtual machine specification version.
191
* @throws SecurityException
192
* if there is a security manager in operation and the caller
193
* does not have permission to check system properties.
194
* @see System#getProperty(java.lang.String)
195
*/
196
public String getSpecVersion();
197
198
/**
199
* Returns the time, in milliseconds, when the virtual machine was started.
200
*
201
* @return the virtual machine start time in milliseconds.
202
*/
203
public long getStartTime();
204
205
/**
206
* Returns a map of the names and values of every system property known to
207
* the virtual machine.
208
*
209
* @return a map containing the names and values of every system property.
210
* @throws SecurityException
211
* if there is a security manager in operation and the caller
212
* does not have permission to check system properties.
213
*/
214
public Map<String, String> getSystemProperties();
215
216
/**
217
* Returns the lifetime of the virtual machine in milliseconds.
218
*
219
* @return the number of milliseconds the virtual machine has been running.
220
*/
221
public long getUptime();
222
223
/**
224
* Returns the name of the Java virtual machine implementation. The value is
225
* identical to that which would be obtained from a call to
226
* {@link System#getProperty(java.lang.String)} supplying the value
227
* &quot;java.vm.name&quot; for the key.
228
*
229
* @return the name of the Java virtual machine implementation.
230
* @throws SecurityException
231
* if there is a security manager in operation and the caller
232
* does not have permission to check system properties.
233
* @see System#getProperty(java.lang.String)
234
*/
235
public String getVmName();
236
237
/**
238
* Returns the name of the Java virtual machine implementation vendor. The
239
* value is identical to that which would be obtained from a call to
240
* {@link System#getProperty(java.lang.String)} supplying the value
241
* &quot;java.vm.vendor&quot; for the key.
242
*
243
* @return the name of the Java virtual machine implementation vendor.
244
* @throws SecurityException
245
* if there is a security manager in operation and the caller
246
* does not have permission to check system properties.
247
* @see System#getProperty(java.lang.String)
248
*/
249
public String getVmVendor();
250
251
/**
252
* Returns the version of the Java virtual machine implementation. The value
253
* is identical to that which would be obtained from a call to
254
* {@link System#getProperty(java.lang.String)} supplying the value
255
* &quot;java.vm.version&quot; for the key.
256
*
257
* @return the version of the Java virtual machine implementation.
258
* @throws SecurityException
259
* if there is a security manager in operation and the caller
260
* does not have permission to check system properties.
261
* @see System#getProperty(java.lang.String)
262
*/
263
public String getVmVersion();
264
265
/**
266
* Returns a boolean indication of whether or not the virtual machine
267
* supports a bootstrap class loading mechanism.
268
*
269
* @return <code>true</code> if supported, <code>false</code> otherwise.
270
*/
271
public boolean isBootClassPathSupported();
272
273
}
274
275