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. package java.lang.management;
  8. /**
  9. * The management interface for the runtime system of
  10. * the Java virtual machine.
  11. *
  12. * <p> A Java virtual machine has a single instance of the implementation
  13. * class of this interface. This instance implementing this interface is
  14. * an <a href="ManagementFactory.html#MXBean">MXBean</a>
  15. * that can be obtained by calling
  16. * the {@link ManagementFactory#getRuntimeMXBean} method or
  17. * from the {@link ManagementFactory#getPlatformMBeanServer
  18. * platform <tt>MBeanServer</tt>} method.
  19. *
  20. * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
  21. * the runtime system within an MBeanServer is:
  22. * <blockquote>
  23. * {@link ManagementFactory#RUNTIME_MXBEAN_NAME
  24. * <tt>java.lang:type=Runtime</tt>}
  25. * </blockquote>
  26. *
  27. * <p> This interface defines several convenient methods for accessing
  28. * system properties about the Java virtual machine.
  29. *
  30. * @see <a href="../../../javax/management/package-summary.html">
  31. * JMX Specification.</a>
  32. * @see <a href="package-summary.html#examples">
  33. * Ways to Access MXBeans</a>
  34. *
  35. * @author Mandy Chung
  36. * @version 1.13, 04/20/04
  37. * @since 1.5
  38. */
  39. public interface RuntimeMXBean {
  40. /**
  41. * Returns the name representing the running Java virtual machine.
  42. * The returned name string can be any arbitrary string and
  43. * a Java virtual machine implementation can choose
  44. * to embed platform-specific useful information in the
  45. * returned name string. Each running virtual machine could have
  46. * a different name.
  47. *
  48. * @return the name representing the running Java virtual machine.
  49. */
  50. public String getName();
  51. /**
  52. * Returns the Java virtual machine implementation name.
  53. * This method is equivalent to {@link System#getProperty
  54. * System.getProperty("java.vm.name")}.
  55. *
  56. * @return the Java virtual machine implementation name.
  57. *
  58. * @throws java.lang.SecurityException
  59. * if a security manager exists and its
  60. * <code>checkPropertiesAccess</code> method doesn't allow access
  61. * to this system property.
  62. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  63. * @see java.lang.System#getProperty
  64. */
  65. public String getVmName();
  66. /**
  67. * Returns the Java virtual machine implementation vendor.
  68. * This method is equivalent to {@link System#getProperty
  69. * System.getProperty("java.vm.vendor")}.
  70. *
  71. * @return the Java virtual machine implementation vendor.
  72. *
  73. * @throws java.lang.SecurityException
  74. * if a security manager exists and its
  75. * <code>checkPropertiesAccess</code> method doesn't allow access
  76. * to this system property.
  77. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  78. * @see java.lang.System#getProperty
  79. */
  80. public String getVmVendor();
  81. /**
  82. * Returns the Java virtual machine implementation version.
  83. * This method is equivalent to {@link System#getProperty
  84. * System.getProperty("java.vm.version")}.
  85. *
  86. * @return the Java virtual machine implementation version.
  87. *
  88. * @throws java.lang.SecurityException
  89. * if a security manager exists and its
  90. * <code>checkPropertiesAccess</code> method doesn't allow access
  91. * to this system property.
  92. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  93. * @see java.lang.System#getProperty
  94. */
  95. public String getVmVersion();
  96. /**
  97. * Returns the Java virtual machine specification name.
  98. * This method is equivalent to {@link System#getProperty
  99. * System.getProperty("java.vm.specification.name")}.
  100. *
  101. * @return the Java virtual machine specification name.
  102. *
  103. * @throws java.lang.SecurityException
  104. * if a security manager exists and its
  105. * <code>checkPropertiesAccess</code> method doesn't allow access
  106. * to this system property.
  107. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  108. * @see java.lang.System#getProperty
  109. */
  110. public String getSpecName();
  111. /**
  112. * Returns the Java virtual machine specification vendor.
  113. * This method is equivalent to {@link System#getProperty
  114. * System.getProperty("java.vm.specification.vendor")}.
  115. *
  116. * @return the Java virtual machine specification vendor.
  117. *
  118. * @throws java.lang.SecurityException
  119. * if a security manager exists and its
  120. * <code>checkPropertiesAccess</code> method doesn't allow access
  121. * to this system property.
  122. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  123. * @see java.lang.System#getProperty
  124. */
  125. public String getSpecVendor();
  126. /**
  127. * Returns the Java virtual machine specification version.
  128. * This method is equivalent to {@link System#getProperty
  129. * System.getProperty("java.vm.specification.version")}.
  130. *
  131. * @return the Java virtual machine specification version.
  132. *
  133. * @throws java.lang.SecurityException
  134. * if a security manager exists and its
  135. * <code>checkPropertiesAccess</code> method doesn't allow access
  136. * to this system property.
  137. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  138. * @see java.lang.System#getProperty
  139. */
  140. public String getSpecVersion();
  141. /**
  142. * Returns the version of the specification for the management interface
  143. * implemented by the running Java virtual machine.
  144. *
  145. * @return the version of the specification for the management interface
  146. * implemented by the running Java virtual machine.
  147. */
  148. public String getManagementSpecVersion();
  149. /**
  150. * Returns the Java class path that is used by the system class loader
  151. * to search for class files.
  152. * This method is equivalent to {@link System#getProperty
  153. * System.getProperty("java.class.path")}.
  154. *
  155. * <p> Multiple paths in the Java class path are separated by the
  156. * path separator character of the platform of the Java virtual machine
  157. * being monitored.
  158. *
  159. * @return the Java class path.
  160. *
  161. * @throws java.lang.SecurityException
  162. * if a security manager exists and its
  163. * <code>checkPropertiesAccess</code> method doesn't allow access
  164. * to this system property.
  165. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  166. * @see java.lang.System#getProperty
  167. */
  168. public String getClassPath();
  169. /**
  170. * Returns the Java library path.
  171. * This method is equivalent to {@link System#getProperty
  172. * System.getProperty("java.library.path")}.
  173. *
  174. * <p> Multiple paths in the Java library path are separated by the
  175. * path separator character of the platform of the Java virtual machine
  176. * being monitored.
  177. *
  178. * @return the Java library path.
  179. *
  180. * @throws java.lang.SecurityException
  181. * if a security manager exists and its
  182. * <code>checkPropertiesAccess</code> method doesn't allow access
  183. * to this system property.
  184. * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
  185. * @see java.lang.System#getProperty
  186. */
  187. public String getLibraryPath();
  188. /**
  189. * Tests if the Java virtual machine supports the boot class path
  190. * mechanism used by the bootstrap class loader to search for class
  191. * files.
  192. *
  193. * @return <tt>true</tt> if the Java virtual machine supports the
  194. * class path mechanism; <tt>false</tt> otherwise.
  195. */
  196. public boolean isBootClassPathSupported();
  197. /**
  198. * Returns the boot class path that is used by the bootstrap class loader
  199. * to search for class files.
  200. *
  201. * <p> Multiple paths in the boot class path are separated by the
  202. * path separator character of the platform on which the Java
  203. * virtual machine is running.
  204. *
  205. * <p>A Java virtual machine implementation may not support
  206. * the boot class path mechanism for the bootstrap class loader
  207. * to search for class files.
  208. * The {@link #isBootClassPathSupported} method can be used
  209. * to determine if the Java virtual machine supports this method.
  210. *
  211. * @return the boot class path.
  212. *
  213. * @throws java.lang.UnsupportedOperationException
  214. * if the Java virtual machine does not support this operation.
  215. *
  216. * @throws java.lang.SecurityException
  217. * if a security manager exists and the caller does not have
  218. * ManagementPermission("monitor").
  219. */
  220. public String getBootClassPath();
  221. /**
  222. * Returns the input arguments passed to the Java virtual machine
  223. * which does not include the arguments to the <tt>main</tt> method.
  224. * This method returns an empty list if there is no input argument
  225. * to the Java virtual machine.
  226. * <p>
  227. * Some Java virtual machine implementations may take input arguments
  228. * from multiple different sources: for examples, arguments passed from
  229. * the application that launches the Java virtual machine such as
  230. * the 'java' command, environment variables, configuration files, etc.
  231. * <p>
  232. * Typically, not all command-line options to the 'java' command
  233. * are passed to the Java virtual machine.
  234. * Thus, the returned input arguments may not
  235. * include all command-line options.
  236. *
  237. * <p>
  238. * <b>MBeanServer access</b>:<br>
  239. * The mapped type of <tt>List<String></tt> is <tt>String[]</tt>.
  240. *
  241. * @return a list of <tt>String</tt> objects; each element
  242. * is an argument passed to the Java virtual machine.
  243. *
  244. * @throws java.lang.SecurityException
  245. * if a security manager exists and the caller does not have
  246. * ManagementPermission("monitor").
  247. */
  248. public java.util.List<String> getInputArguments();
  249. /**
  250. * Returns the uptime of the Java virtual machine in milliseconds.
  251. *
  252. * @return uptime of the Java virtual machine in milliseconds.
  253. */
  254. public long getUptime();
  255. /**
  256. * Returns the start time of the Java virtual machine in milliseconds.
  257. * This method returns the approximate time when the Java virtual
  258. * machine started.
  259. *
  260. * @return start time of the Java virtual machine in milliseconds.
  261. *
  262. */
  263. public long getStartTime();
  264. /**
  265. * Returns a map of names and values of all system properties.
  266. * This method calls {@link System#getProperties} to get all
  267. * system properties. Properties whose name or value is not
  268. * a <tt>String</tt> are omitted.
  269. *
  270. * <p>
  271. * <b>MBeanServer access</b>:<br>
  272. * The mapped type of <tt>Map<String,String></tt> is
  273. * {@link javax.management.openmbean.TabularData TabularData}
  274. * with two items in each row as follows:
  275. * <blockquote>
  276. * <table border>
  277. * <tr>
  278. * <th>Item Name</th>
  279. * <th>Item Type</th>
  280. * </tr>
  281. * <tr>
  282. * <td><tt>key</tt></td>
  283. * <td><tt>String</tt></td>
  284. * </tr>
  285. * <tr>
  286. * <td><tt>value</tt></td>
  287. * <td><tt>String</tt></td>
  288. * </tr>
  289. * </table>
  290. * </blockquote>
  291. *
  292. * @return a map of names and values of all system properties.
  293. *
  294. * @throws java.lang.SecurityException
  295. * if a security manager exists and its
  296. * <code>checkPropertiesAccess</code> method doesn't allow access
  297. * to the system properties.
  298. */
  299. public java.util.Map<String, String> getSystemProperties();
  300. }