001 /*
002 * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.lang.management;
027
028 /**
029 * The management interface for the runtime system of
030 * the Java virtual machine.
031 *
032 * <p> A Java virtual machine has a single instance of the implementation
033 * class of this interface. This instance implementing this interface is
034 * an <a href="ManagementFactory.html#MXBean">MXBean</a>
035 * that can be obtained by calling
036 * the {@link ManagementFactory#getRuntimeMXBean} method or
037 * from the {@link ManagementFactory#getPlatformMBeanServer
038 * platform <tt>MBeanServer</tt>} method.
039 *
040 * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
041 * the runtime system within an MBeanServer is:
042 * <blockquote>
043 * {@link ManagementFactory#RUNTIME_MXBEAN_NAME
044 * <tt>java.lang:type=Runtime</tt>}
045 * </blockquote>
046 *
047 * <p> This interface defines several convenient methods for accessing
048 * system properties about the Java virtual machine.
049 *
050 * @see <a href="../../../javax/management/package-summary.html">
051 * JMX Specification.</a>
052 * @see <a href="package-summary.html#examples">
053 * Ways to Access MXBeans</a>
054 *
055 * @author Mandy Chung
056 * @version 1.20, 05/05/07
057 * @since 1.5
058 */
059 public interface RuntimeMXBean {
060 /**
061 * Returns the name representing the running Java virtual machine.
062 * The returned name string can be any arbitrary string and
063 * a Java virtual machine implementation can choose
064 * to embed platform-specific useful information in the
065 * returned name string. Each running virtual machine could have
066 * a different name.
067 *
068 * @return the name representing the running Java virtual machine.
069 */
070 public String getName();
071
072 /**
073 * Returns the Java virtual machine implementation name.
074 * This method is equivalent to {@link System#getProperty
075 * System.getProperty("java.vm.name")}.
076 *
077 * @return the Java virtual machine implementation name.
078 *
079 * @throws java.lang.SecurityException
080 * if a security manager exists and its
081 * <code>checkPropertiesAccess</code> method doesn't allow access
082 * to this system property.
083 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
084 * @see java.lang.System#getProperty
085 */
086 public String getVmName();
087
088 /**
089 * Returns the Java virtual machine implementation vendor.
090 * This method is equivalent to {@link System#getProperty
091 * System.getProperty("java.vm.vendor")}.
092 *
093 * @return the Java virtual machine implementation vendor.
094 *
095 * @throws java.lang.SecurityException
096 * if a security manager exists and its
097 * <code>checkPropertiesAccess</code> method doesn't allow access
098 * to this system property.
099 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
100 * @see java.lang.System#getProperty
101 */
102 public String getVmVendor();
103
104 /**
105 * Returns the Java virtual machine implementation version.
106 * This method is equivalent to {@link System#getProperty
107 * System.getProperty("java.vm.version")}.
108 *
109 * @return the Java virtual machine implementation version.
110 *
111 * @throws java.lang.SecurityException
112 * if a security manager exists and its
113 * <code>checkPropertiesAccess</code> method doesn't allow access
114 * to this system property.
115 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
116 * @see java.lang.System#getProperty
117 */
118 public String getVmVersion();
119
120 /**
121 * Returns the Java virtual machine specification name.
122 * This method is equivalent to {@link System#getProperty
123 * System.getProperty("java.vm.specification.name")}.
124 *
125 * @return the Java virtual machine specification name.
126 *
127 * @throws java.lang.SecurityException
128 * if a security manager exists and its
129 * <code>checkPropertiesAccess</code> method doesn't allow access
130 * to this system property.
131 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
132 * @see java.lang.System#getProperty
133 */
134 public String getSpecName();
135
136 /**
137 * Returns the Java virtual machine specification vendor.
138 * This method is equivalent to {@link System#getProperty
139 * System.getProperty("java.vm.specification.vendor")}.
140 *
141 * @return the Java virtual machine specification vendor.
142 *
143 * @throws java.lang.SecurityException
144 * if a security manager exists and its
145 * <code>checkPropertiesAccess</code> method doesn't allow access
146 * to this system property.
147 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
148 * @see java.lang.System#getProperty
149 */
150 public String getSpecVendor();
151
152 /**
153 * Returns the Java virtual machine specification version.
154 * This method is equivalent to {@link System#getProperty
155 * System.getProperty("java.vm.specification.version")}.
156 *
157 * @return the Java virtual machine specification version.
158 *
159 * @throws java.lang.SecurityException
160 * if a security manager exists and its
161 * <code>checkPropertiesAccess</code> method doesn't allow access
162 * to this system property.
163 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
164 * @see java.lang.System#getProperty
165 */
166 public String getSpecVersion();
167
168 /**
169 * Returns the version of the specification for the management interface
170 * implemented by the running Java virtual machine.
171 *
172 * @return the version of the specification for the management interface
173 * implemented by the running Java virtual machine.
174 */
175 public String getManagementSpecVersion();
176
177 /**
178 * Returns the Java class path that is used by the system class loader
179 * to search for class files.
180 * This method is equivalent to {@link System#getProperty
181 * System.getProperty("java.class.path")}.
182 *
183 * <p> Multiple paths in the Java class path are separated by the
184 * path separator character of the platform of the Java virtual machine
185 * being monitored.
186 *
187 * @return the Java class path.
188 *
189 * @throws java.lang.SecurityException
190 * if a security manager exists and its
191 * <code>checkPropertiesAccess</code> method doesn't allow access
192 * to this system property.
193 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
194 * @see java.lang.System#getProperty
195 */
196 public String getClassPath();
197
198 /**
199 * Returns the Java library path.
200 * This method is equivalent to {@link System#getProperty
201 * System.getProperty("java.library.path")}.
202 *
203 * <p> Multiple paths in the Java library path are separated by the
204 * path separator character of the platform of the Java virtual machine
205 * being monitored.
206 *
207 * @return the Java library path.
208 *
209 * @throws java.lang.SecurityException
210 * if a security manager exists and its
211 * <code>checkPropertiesAccess</code> method doesn't allow access
212 * to this system property.
213 * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
214 * @see java.lang.System#getProperty
215 */
216 public String getLibraryPath();
217
218 /**
219 * Tests if the Java virtual machine supports the boot class path
220 * mechanism used by the bootstrap class loader to search for class
221 * files.
222 *
223 * @return <tt>true</tt> if the Java virtual machine supports the
224 * class path mechanism; <tt>false</tt> otherwise.
225 */
226 public boolean isBootClassPathSupported();
227
228 /**
229 * Returns the boot class path that is used by the bootstrap class loader
230 * to search for class files.
231 *
232 * <p> Multiple paths in the boot class path are separated by the
233 * path separator character of the platform on which the Java
234 * virtual machine is running.
235 *
236 * <p>A Java virtual machine implementation may not support
237 * the boot class path mechanism for the bootstrap class loader
238 * to search for class files.
239 * The {@link #isBootClassPathSupported} method can be used
240 * to determine if the Java virtual machine supports this method.
241 *
242 * @return the boot class path.
243 *
244 * @throws java.lang.UnsupportedOperationException
245 * if the Java virtual machine does not support this operation.
246 *
247 * @throws java.lang.SecurityException
248 * if a security manager exists and the caller does not have
249 * ManagementPermission("monitor").
250 */
251 public String getBootClassPath();
252
253 /**
254 * Returns the input arguments passed to the Java virtual machine
255 * which does not include the arguments to the <tt>main</tt> method.
256 * This method returns an empty list if there is no input argument
257 * to the Java virtual machine.
258 * <p>
259 * Some Java virtual machine implementations may take input arguments
260 * from multiple different sources: for examples, arguments passed from
261 * the application that launches the Java virtual machine such as
262 * the 'java' command, environment variables, configuration files, etc.
263 * <p>
264 * Typically, not all command-line options to the 'java' command
265 * are passed to the Java virtual machine.
266 * Thus, the returned input arguments may not
267 * include all command-line options.
268 *
269 * <p>
270 * <b>MBeanServer access</b>:<br>
271 * The mapped type of <tt>List<String></tt> is <tt>String[]</tt>.
272 *
273 * @return a list of <tt>String</tt> objects; each element
274 * is an argument passed to the Java virtual machine.
275 *
276 * @throws java.lang.SecurityException
277 * if a security manager exists and the caller does not have
278 * ManagementPermission("monitor").
279 */
280 public java.util.List<String> getInputArguments();
281
282 /**
283 * Returns the uptime of the Java virtual machine in milliseconds.
284 *
285 * @return uptime of the Java virtual machine in milliseconds.
286 */
287 public long getUptime();
288
289 /**
290 * Returns the start time of the Java virtual machine in milliseconds.
291 * This method returns the approximate time when the Java virtual
292 * machine started.
293 *
294 * @return start time of the Java virtual machine in milliseconds.
295 *
296 */
297 public long getStartTime();
298
299 /**
300 * Returns a map of names and values of all system properties.
301 * This method calls {@link System#getProperties} to get all
302 * system properties. Properties whose name or value is not
303 * a <tt>String</tt> are omitted.
304 *
305 * <p>
306 * <b>MBeanServer access</b>:<br>
307 * The mapped type of <tt>Map<String,String></tt> is
308 * {@link javax.management.openmbean.TabularData TabularData}
309 * with two items in each row as follows:
310 * <blockquote>
311 * <table border>
312 * <tr>
313 * <th>Item Name</th>
314 * <th>Item Type</th>
315 * </tr>
316 * <tr>
317 * <td><tt>key</tt></td>
318 * <td><tt>String</tt></td>
319 * </tr>
320 * <tr>
321 * <td><tt>value</tt></td>
322 * <td><tt>String</tt></td>
323 * </tr>
324 * </table>
325 * </blockquote>
326 *
327 * @return a map of names and values of all system properties.
328 *
329 * @throws java.lang.SecurityException
330 * if a security manager exists and its
331 * <code>checkPropertiesAccess</code> method doesn't allow access
332 * to the system properties.
333 */
334 public java.util.Map<String, String> getSystemProperties();
335 }
|