Source for java.lang.management.RuntimeMXBean

   1: /* RuntimeMXBean.java - Interface for a runtime bean
   2:    Copyright (C) 2006 Free Software Foundation
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: package java.lang.management;
  39: 
  40: import java.util.List;
  41: import java.util.Map;
  42: 
  43: /**
  44:  * Provides access to information about the underlying virtual
  45:  * machine.  An instance of this bean is obtained by calling
  46:  * {@link ManagementFactory#getRuntimeMXBean()}.
  47:  *
  48:  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  49:  * @since 1.5
  50:  */
  51: public interface RuntimeMXBean
  52: {
  53: 
  54:   /**
  55:    * <p>
  56:    * Returns the boot classpath used by the virtual machine.  This
  57:    * value follows the standard path syntax used by the underlying
  58:    * operating system (e.g. directories separated by ':' on UNIX
  59:    * or ';' on Windows).
  60:    * </p>
  61:    * <p>
  62:    * Supplying this value is optional.  Users should check the
  63:    * return value of {@link isBootClassPathSupported()} prior to
  64:    * calling this method.
  65:    * </p>
  66:    *
  67:    * @return the boot classpath of the virtual machine, if supported.
  68:    * @throws UnsupportedOperationException in cases where this
  69:    *                                       functionality is not
  70:    *                                       supported by the VM.
  71:    * @throws SecurityException if a security manager exists and
  72:    *                           denies ManagementPermission("monitor").
  73:    * @see #isBootClassPathSupported()
  74:    * @see java.lang.management.ManagementPermission
  75:    */
  76:   String getBootClassPath();
  77: 
  78:   /**
  79:    * Returns the classpath used by the system classloader.  This
  80:    * is equivalent to obtaining the <code>java.class.path</code>
  81:    * property via {@link System#getProperty(String)}.  This value
  82:    * follows the standard path syntax used by the underlying operating
  83:    * system (e.g. directories separated by ':' on UNIX or ';' on
  84:    * Windows).
  85:    *
  86:    * @return the classpath used by the system class loader.
  87:    * @throws SecurityException if a security manager exists which
  88:    *                           prevents access to the classpath
  89:    *                           property.
  90:    * @see java.lang.System#getProperty(String)
  91:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
  92:    */
  93:   String getClassPath();
  94: 
  95:   /**
  96:    * Returns a list of the arguments given to the virtual machine,
  97:    * excluding those that apply to the <code>main()</code> method
  98:    * of the class file being executed.  These may not just be those
  99:    * specified at the command line, but may also include arguments
 100:    * from environment variables, configuration files, etc.  All
 101:    * command line arguments may not reach the virtual machine, so
 102:    * these are not included in this list.
 103:    *
 104:    * @return a list of arguments passed to the virtual machine.
 105:    * @throws SecurityException if a security manager exists and
 106:    *                           denies ManagementPermission("monitor").
 107:    * @see java.lang.management.ManagementPermission
 108:    */
 109:   List<String> getInputArguments();
 110: 
 111:   /**
 112:    * Returns the library path.  This is equivalent to obtaining the
 113:    * <code>java.library.path</code> property via
 114:    * {@link System#getProperty(String)}.  This value follows the
 115:    * standard path syntax used by the underlying operating
 116:    * system (e.g. directories separated by ':' on UNIX or ';' on
 117:    * Windows).
 118:    *
 119:    * @return the library path.
 120:    * @throws SecurityException if a security manager exists which
 121:    *                           prevents access to the library path
 122:    *                           property.
 123:    * @see java.lang.System#getProperty(String)
 124:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 125:    */
 126:   String getLibraryPath();
 127: 
 128:   /**
 129:    * Returns the version of the management specification
 130:    * implemented by the virtual machine.
 131:    *
 132:    * @return the version of the management specification
 133:    *         implemented.
 134:    */
 135:   String getManagementSpecVersion();
 136: 
 137:   /**
 138:    * Returns the name of this virtual machine.  The content
 139:    * of this property is left up to the developer of the
 140:    * virtual machine.  It may include a number of system
 141:    * attributes and may differ between instances of the
 142:    * same virtual machine (for example, it might include
 143:    * the process identifier or the host name of the machine
 144:    * on which it is running).  The intention is that this
 145:    * name refers to the precise entity that the other data
 146:    * supplied by this bean refers to, rather than the VM
 147:    * in general.
 148:    *
 149:    * @return the name of this virtual machine.
 150:    */
 151:   String getName();
 152: 
 153:   /**
 154:    * Returns the specification name of the virtual machine.
 155:    * This is equivalent to obtaining the
 156:    * <code>java.vm.specification.name</code> property via
 157:    * {@link System#getProperty(String)}.
 158:    *
 159:    * @return the specification name of the VM.
 160:    * @throws SecurityException if a security manager exists which
 161:    *                           prevents access to the VM
 162:    *                           specification name property.
 163:    * @see java.lang.System#getProperty(String)
 164:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 165:    */
 166:   String getSpecName();
 167: 
 168:   /**
 169:    * Returns the specification vendor of the virtual machine.
 170:    * This is equivalent to obtaining the
 171:    * <code>java.vm.specification.vendor</code> property via
 172:    * {@link System#getProperty(String)}.
 173:    *
 174:    * @return the specification vendor of the VM.
 175:    * @throws SecurityException if a security manager exists which
 176:    *                           prevents access to the VM
 177:    *                           specification vendor property.
 178:    * @see java.lang.System#getProperty(String)
 179:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 180:    */
 181:   String getSpecVendor();
 182: 
 183:   /**
 184:    * Returns the specification version of the virtual machine.
 185:    * This is equivalent to obtaining the
 186:    * <code>java.vm.specification.version</code> property via
 187:    * {@link System#getProperty(String)}.
 188:    *
 189:    * @return the specification version of the VM.
 190:    * @throws SecurityException if a security manager exists which
 191:    *                           prevents access to the VM
 192:    *                           specification version property.
 193:    * @see java.lang.System#getProperty(String)
 194:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 195:    */
 196:   String getSpecVersion();
 197: 
 198:   /**
 199:    * Returns the approximate start time of the virtual machine
 200:    * in milliseconds.
 201:    *
 202:    * @return the start time of the virtual machine.
 203:    */
 204:   long getStartTime();
 205: 
 206:   /**
 207:    * Returns a map containing the keys and values of the system
 208:    * properties.  This gives largely the same result as calling
 209:    * {@link System#getProperties()}, but the resulting map
 210:    * is filtered so as to only provide keys and values that
 211:    * are <code>String</code>s.
 212:    *
 213:    * @return the map of system properties.
 214:    */
 215:   Map<String,String> getSystemProperties();
 216: 
 217:   /**
 218:    * Returns the uptime of the virtual machine in milliseconds.
 219:    *
 220:    * @return the uptime of the virtual machine.
 221:    */
 222:   long getUptime();
 223: 
 224:   /**
 225:    * Returns the implementation name of the virtual machine.
 226:    * This is equivalent to obtaining the
 227:    * <code>java.vm.name</code> property via
 228:    * {@link System#getProperty(String)}.
 229:    *
 230:    * @return the implementation name of the VM.
 231:    * @throws SecurityException if a security manager exists which
 232:    *                           prevents access to the VM name
 233:    *                           property.
 234:    * @see java.lang.System#getProperty(String)
 235:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 236:    */
 237:   String getVmName();
 238: 
 239:   /**
 240:    * Returns the implementation vendor of the virtual machine.
 241:    * This is equivalent to obtaining the
 242:    * <code>java.vm.vendor</code> property via
 243:    * {@link System#getProperty(String)}.
 244:    *
 245:    * @return the implementation vendor of the VM.
 246:    * @throws SecurityException if a security manager exists which
 247:    *                           prevents access to the VM vendor
 248:    *                           property.
 249:    * @see java.lang.System#getProperty(String)
 250:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 251:    */
 252:   String getVmVendor();
 253: 
 254:   /**
 255:    * Returns the implementation version of the virtual machine.
 256:    * This is equivalent to obtaining the
 257:    * <code>java.vm.version</code> property via
 258:    * {@link System#getProperty(String)}.
 259:    *
 260:    * @return the implementation version of the VM.
 261:    * @throws SecurityException if a security manager exists which
 262:    *                           prevents access to the VM version
 263:    *                           property.
 264:    * @see java.lang.System#getProperty(String)
 265:    * @see java.lang.SecurityManager#checkPropertyAccess(String)
 266:    */
 267:   String getVmVersion();
 268: 
 269:   /**
 270:    * Returns true if the virtual machine supports the boot classpath
 271:    * mechanism.
 272:    *
 273:    * @return true if the boot classpath property is supported by the
 274:    *         virtual machine.
 275:    */
 276:   boolean isBootClassPathSupported();
 277: 
 278: }