KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > management > RuntimeMXBean


1 /*
2  * @(#)RuntimeMXBean.java 1.13 04/04/20
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang.management;
9
10 /**
11  * The management interface for the runtime system of
12  * the Java virtual machine.
13  *
14  * <p> A Java virtual machine has a single instance of the implementation
15  * class of this interface. This instance implementing this interface is
16  * an <a HREF="ManagementFactory.html#MXBean">MXBean</a>
17  * that can be obtained by calling
18  * the {@link ManagementFactory#getRuntimeMXBean} method or
19  * from the {@link ManagementFactory#getPlatformMBeanServer
20  * platform <tt>MBeanServer</tt>} method.
21  *
22  * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
23  * the runtime system within an MBeanServer is:
24  * <blockquote>
25  * {@link ManagementFactory#RUNTIME_MXBEAN_NAME
26  * <tt>java.lang:type=Runtime</tt>}
27  * </blockquote>
28  *
29  * <p> This interface defines several convenient methods for accessing
30  * system properties about the Java virtual machine.
31  *
32  * @see <a HREF="../../../javax/management/package-summary.html">
33  * JMX Specification.</a>
34  * @see <a HREF="package-summary.html#examples">
35  * Ways to Access MXBeans</a>
36  *
37  * @author Mandy Chung
38  * @version 1.13, 04/20/04
39  * @since 1.5
40  */

41 public interface RuntimeMXBean {
42     /**
43      * Returns the name representing the running Java virtual machine.
44      * The returned name string can be any arbitrary string and
45      * a Java virtual machine implementation can choose
46      * to embed platform-specific useful information in the
47      * returned name string. Each running virtual machine could have
48      * a different name.
49      *
50      * @return the name representing the running Java virtual machine.
51      */

52     public String JavaDoc getName();
53
54     /**
55      * Returns the Java virtual machine implementation name.
56      * This method is equivalent to {@link System#getProperty
57      * System.getProperty("java.vm.name")}.
58      *
59      * @return the Java virtual machine implementation name.
60      *
61      * @throws java.lang.SecurityException
62      * if a security manager exists and its
63      * <code>checkPropertiesAccess</code> method doesn't allow access
64      * to this system property.
65      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
66      * @see java.lang.System#getProperty
67      */

68     public String JavaDoc getVmName();
69
70     /**
71      * Returns the Java virtual machine implementation vendor.
72      * This method is equivalent to {@link System#getProperty
73      * System.getProperty("java.vm.vendor")}.
74      *
75      * @return the Java virtual machine implementation vendor.
76      *
77      * @throws java.lang.SecurityException
78      * if a security manager exists and its
79      * <code>checkPropertiesAccess</code> method doesn't allow access
80      * to this system property.
81      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
82      * @see java.lang.System#getProperty
83      */

84     public String JavaDoc getVmVendor();
85
86     /**
87      * Returns the Java virtual machine implementation version.
88      * This method is equivalent to {@link System#getProperty
89      * System.getProperty("java.vm.version")}.
90      *
91      * @return the Java virtual machine implementation version.
92      *
93      * @throws java.lang.SecurityException
94      * if a security manager exists and its
95      * <code>checkPropertiesAccess</code> method doesn't allow access
96      * to this system property.
97      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
98      * @see java.lang.System#getProperty
99      */

100     public String JavaDoc getVmVersion();
101
102     /**
103      * Returns the Java virtual machine specification name.
104      * This method is equivalent to {@link System#getProperty
105      * System.getProperty("java.vm.specification.name")}.
106      *
107      * @return the Java virtual machine specification name.
108      *
109      * @throws java.lang.SecurityException
110      * if a security manager exists and its
111      * <code>checkPropertiesAccess</code> method doesn't allow access
112      * to this system property.
113      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
114      * @see java.lang.System#getProperty
115      */

116     public String JavaDoc getSpecName();
117
118     /**
119      * Returns the Java virtual machine specification vendor.
120      * This method is equivalent to {@link System#getProperty
121      * System.getProperty("java.vm.specification.vendor")}.
122      *
123      * @return the Java virtual machine specification vendor.
124      *
125      * @throws java.lang.SecurityException
126      * if a security manager exists and its
127      * <code>checkPropertiesAccess</code> method doesn't allow access
128      * to this system property.
129      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
130      * @see java.lang.System#getProperty
131      */

132     public String JavaDoc getSpecVendor();
133
134     /**
135      * Returns the Java virtual machine specification version.
136      * This method is equivalent to {@link System#getProperty
137      * System.getProperty("java.vm.specification.version")}.
138      *
139      * @return the Java virtual machine specification version.
140      *
141      * @throws java.lang.SecurityException
142      * if a security manager exists and its
143      * <code>checkPropertiesAccess</code> method doesn't allow access
144      * to this system property.
145      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
146      * @see java.lang.System#getProperty
147      */

148     public String JavaDoc getSpecVersion();
149
150
151     /**
152      * Returns the version of the specification for the management interface
153      * implemented by the running Java virtual machine.
154      *
155      * @return the version of the specification for the management interface
156      * implemented by the running Java virtual machine.
157      */

158     public String JavaDoc getManagementSpecVersion();
159
160     /**
161      * Returns the Java class path that is used by the system class loader
162      * to search for class files.
163      * This method is equivalent to {@link System#getProperty
164      * System.getProperty("java.class.path")}.
165      *
166      * <p> Multiple paths in the Java class path are separated by the
167      * path separator character of the platform of the Java virtual machine
168      * being monitored.
169      *
170      * @return the Java class path.
171      *
172      * @throws java.lang.SecurityException
173      * if a security manager exists and its
174      * <code>checkPropertiesAccess</code> method doesn't allow access
175      * to this system property.
176      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
177      * @see java.lang.System#getProperty
178      */

179     public String JavaDoc getClassPath();
180
181     /**
182      * Returns the Java library path.
183      * This method is equivalent to {@link System#getProperty
184      * System.getProperty("java.library.path")}.
185      *
186      * <p> Multiple paths in the Java library path are separated by the
187      * path separator character of the platform of the Java virtual machine
188      * being monitored.
189      *
190      * @return the Java library path.
191      *
192      * @throws java.lang.SecurityException
193      * if a security manager exists and its
194      * <code>checkPropertiesAccess</code> method doesn't allow access
195      * to this system property.
196      * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
197      * @see java.lang.System#getProperty
198      */

199     public String JavaDoc getLibraryPath();
200
201     /**
202      * Tests if the Java virtual machine supports the boot class path
203      * mechanism used by the bootstrap class loader to search for class
204      * files.
205      *
206      * @return <tt>true</tt> if the Java virtual machine supports the
207      * class path mechanism; <tt>false</tt> otherwise.
208      */

209     public boolean isBootClassPathSupported();
210
211     /**
212      * Returns the boot class path that is used by the bootstrap class loader
213      * to search for class files.
214      *
215      * <p> Multiple paths in the boot class path are separated by the
216      * path separator character of the platform on which the Java
217      * virtual machine is running.
218      *
219      * <p>A Java virtual machine implementation may not support
220      * the boot class path mechanism for the bootstrap class loader
221      * to search for class files.
222      * The {@link #isBootClassPathSupported} method can be used
223      * to determine if the Java virtual machine supports this method.
224      *
225      * @return the boot class path.
226      *
227      * @throws java.lang.UnsupportedOperationException
228      * if the Java virtual machine does not support this operation.
229      *
230      * @throws java.lang.SecurityException
231      * if a security manager exists and the caller does not have
232      * ManagementPermission("monitor").
233      */

234     public String JavaDoc getBootClassPath();
235
236     /**
237      * Returns the input arguments passed to the Java virtual machine
238      * which does not include the arguments to the <tt>main</tt> method.
239      * This method returns an empty list if there is no input argument
240      * to the Java virtual machine.
241      * <p>
242      * Some Java virtual machine implementations may take input arguments
243      * from multiple different sources: for examples, arguments passed from
244      * the application that launches the Java virtual machine such as
245      * the 'java' command, environment variables, configuration files, etc.
246      * <p>
247      * Typically, not all command-line options to the 'java' command
248      * are passed to the Java virtual machine.
249      * Thus, the returned input arguments may not
250      * include all command-line options.
251      *
252      * <p>
253      * <b>MBeanServer access</b>:<br>
254      * The mapped type of <tt>List<String></tt> is <tt>String[]</tt>.
255      *
256      * @return a list of <tt>String</tt> objects; each element
257      * is an argument passed to the Java virtual machine.
258      *
259      * @throws java.lang.SecurityException
260      * if a security manager exists and the caller does not have
261      * ManagementPermission("monitor").
262      */

263     public java.util.List JavaDoc<String JavaDoc> getInputArguments();
264
265     /**
266      * Returns the uptime of the Java virtual machine in milliseconds.
267      *
268      * @return uptime of the Java virtual machine in milliseconds.
269      */

270     public long getUptime();
271
272     /**
273      * Returns the start time of the Java virtual machine in milliseconds.
274      * This method returns the approximate time when the Java virtual
275      * machine started.
276      *
277      * @return start time of the Java virtual machine in milliseconds.
278      *
279      */

280     public long getStartTime();
281
282     /**
283      * Returns a map of names and values of all system properties.
284      * This method calls {@link System#getProperties} to get all
285      * system properties. Properties whose name or value is not
286      * a <tt>String</tt> are omitted.
287      *
288      * <p>
289      * <b>MBeanServer access</b>:<br>
290      * The mapped type of <tt>Map<String,String></tt> is
291      * {@link javax.management.openmbean.TabularData TabularData}
292      * with two items in each row as follows:
293      * <blockquote>
294      * <table border>
295      * <tr>
296      * <th>Item Name</th>
297      * <th>Item Type</th>
298      * </tr>
299      * <tr>
300      * <td><tt>key</tt></td>
301      * <td><tt>String</tt></td>
302      * </tr>
303      * <tr>
304      * <td><tt>value</tt></td>
305      * <td><tt>String</tt></td>
306      * </tr>
307      * </table>
308      * </blockquote>
309      *
310      * @return a map of names and values of all system properties.
311      *
312      * @throws java.lang.SecurityException
313      * if a security manager exists and its
314      * <code>checkPropertiesAccess</code> method doesn't allow access
315      * to the system properties.
316      */

317     public java.util.Map JavaDoc<String JavaDoc, String JavaDoc> getSystemProperties();
318 }
319
320
Popular Tags