Main Page | Class Hierarchy | Class List | Directories | Class Members | Related Pages

com.ibm.oti.vm.VM Class Reference

List of all members.

Detailed Description

This class must be implemented by the vm vendor.

Represents the running virtual machine. All VM specific API are implemented on this class.

Note that all methods in VM are static. There is no singleton instance which represents the actively running VM.


Static Public Member Functions

static final ClassLoader getNonBootstrapClassLoader ()
 This method must be provided by the vm vendor, as it is used by other provided class implementations.
static final void initializeClassLoader (ClassLoader loader, boolean bootLoader)
 Initialize the classloader.
static ClassLoader callerClassLoader ()
 This method must be included, as it is used by ResourceBundle.getBundle(), and other places as well.
static void dumpString (String str)
 Native used to dump a string to the system console for debugging.
static void addShutdownHook (Thread hook)
 Registers a new virtual-machine shutdown hook.
static boolean removeShutdownHook (Thread hook)
 De-registers a previously-registered virtual-machine shutdown hook.
static void closeJars ()
 This method must be provided by the vm vendor.
static void deleteOnExit ()
 This method must be provided by the vm vendor.
static String[] getVMArgs ()
 Returns command line arguments passed to the VM.

Static Package Functions

static final ClassLoader getStackClassLoader (int depth)
 This method must be provided by the vm vendor, as it is used by com.ibm.oti.vm.MsgHelp.setLocale() to get the bootstrap ClassLoader.
static Class findClassOrNull (String className, ClassLoader classLoader)
 Native used to find and load a class using the VM.
static int getCPIndexImpl (Class targetClass)
 Get the classpath entry that was used to load the class that is the arg.
static void initializeVM ()
 Does internal initializaion required by VM.
static final int getClassPathEntryType (Object classLoader, int cpIndex)
 Return the type of the specified entry on the class path for a ClassLoader.
static int getClassPathCount ()
 Return the number of entries on the bootclasspath.
static byte[] getPathFromClassPath (int index)
 Return the specified bootclasspath entry.

Static Package Attributes

static final int CPE_TYPE_UNKNOWN = 0
static final int CPE_TYPE_DIRECTORY = 1
static final int CPE_TYPE_JAR = 2
static final int CPE_TYPE_TCP = 3
static final int CPE_TYPE_UNUSABLE = 5


Member Function Documentation

static final ClassLoader com.ibm.oti.vm.VM.getStackClassLoader int  depth  )  [static, package]
 

This method must be provided by the vm vendor, as it is used by com.ibm.oti.vm.MsgHelp.setLocale() to get the bootstrap ClassLoader.

MsgHelp uses the bootstrap ClassLoader to find the resource bundle of messages packaged with the bootstrap classes. Returns the ClassLoader of the method (including natives) at the specified depth on the stack of the calling thread. Frames representing the VM implementation of java.lang.reflect are not included in the list. This is not a public method as it can return the bootstrap class loader, which should not be accessed by non-bootstrap classes. Notes:

  • This method operates on the defining classes of methods on stack. NOT the classes of receivers.
  • The item at depth zero is the caller of this method

Parameters:
depth the stack depth of the requested ClassLoader
Returns:
the ClassLoader at the specified depth
See also:
java.lang.ClassLoader.getStackClassLoader

static final ClassLoader com.ibm.oti.vm.VM.getNonBootstrapClassLoader  )  [static]
 

This method must be provided by the vm vendor, as it is used by other provided class implementations.

For example, java.io.ObjectInputStream.readObject() and java.io.ObjectInputStream.resolveProxyClass(). It is also useful for other classes, such as java.rmi.server.RMIClassLoader. Walk the stack and answer the most recent non-null and non-bootstrap ClassLoader on the stack of the calling thread. If no such ClassLoader is found, null is returned. Notes: 1) This method operates on the defining classes of methods on stack. NOT the classes of receivers.

Returns:
the first non-bootstrap ClassLoader on the stack

static final void com.ibm.oti.vm.VM.initializeClassLoader ClassLoader  loader,
boolean  bootLoader
[static]
 

Initialize the classloader.

Parameters:
loader ClassLoader the ClassLoader instance
bootLoader boolean true for the bootstrap class loader

static Class com.ibm.oti.vm.VM.findClassOrNull String  className,
ClassLoader  classLoader
[static, package]
 

Native used to find and load a class using the VM.

Returns:
java.lang.Class the class or null.
Parameters:
className String the name of the class to search for.
classLoader the classloader to do the work

static ClassLoader com.ibm.oti.vm.VM.callerClassLoader  )  [static]
 

This method must be included, as it is used by ResourceBundle.getBundle(), and other places as well.

The reference implementation of this method uses the getStackClassLoader() method. Returns the ClassLoader of the method that called the caller. i.e. A.x() calls B.y() calls callerClassLoader(), A's ClassLoader will be returned. Returns null for the bootstrap ClassLoader.

Returns:
a ClassLoader or null for the bootstrap ClassLoader
Exceptions:
SecurityException when called from a non-bootstrap Class

static void com.ibm.oti.vm.VM.dumpString String  str  )  [static]
 

Native used to dump a string to the system console for debugging.

Parameters:
str String the String to display

static int com.ibm.oti.vm.VM.getCPIndexImpl Class  targetClass  )  [static, package]
 

Get the classpath entry that was used to load the class that is the arg.

This method is for internal use only.

Parameters:
targetClass Class the class to set the classpath of.
See also:
java.lang.Class

static void com.ibm.oti.vm.VM.initializeVM  )  [static, package]
 

Does internal initializaion required by VM.

static void com.ibm.oti.vm.VM.addShutdownHook Thread  hook  )  [static]
 

Registers a new virtual-machine shutdown hook.

This is equivalent to the 1.3 API of the same name.

Parameters:
hook the hook (a Thread) to register

static boolean com.ibm.oti.vm.VM.removeShutdownHook Thread  hook  )  [static]
 

De-registers a previously-registered virtual-machine shutdown hook.

This is equivalent to the 1.3 API of the same name.

Parameters:
hook the hook (a Thread) to de-register
Returns:
true if the hook could be de-registered

static void com.ibm.oti.vm.VM.closeJars  )  [static]
 

This method must be provided by the vm vendor.

Called to signal that the com.ibm.oti.net.www.protocol.jar.JarURLConnection class has been loaded and JarURLConnection.closeCachedFiles() should be called on VM shutdown.

See also:
shutdown()

static void com.ibm.oti.vm.VM.deleteOnExit  )  [static]
 

This method must be provided by the vm vendor.

Called to signal that the com.ibm.oti.util.DeleteOnExit class has been loaded and DeleteOnExit.deleteOnExit() should be called on VM shutdown.

See also:
shutdown()

static final int com.ibm.oti.vm.VM.getClassPathEntryType Object  classLoader,
int  cpIndex
[static, package]
 

Return the type of the specified entry on the class path for a ClassLoader.

Valid tyes are: CPE_TYPE_UNKNOWN CPE_TYPE_DIRECTORY CPE_TYPE_JAR CPE_TYPE_TCP - this is obsolete CPE_TYPE_UNUSABLE

Parameters:
classLoader the ClassLoader
cpIndex the index on the class path
Returns:
a int which specifies the class path entry type

static String [] com.ibm.oti.vm.VM.getVMArgs  )  [static]
 

Returns command line arguments passed to the VM.

Internally these are broken into optionString and extraInfo. This only returns the optionString part.

Returns:
a String array containing the optionString part of command line arguments

static int com.ibm.oti.vm.VM.getClassPathCount  )  [static, package]
 

Return the number of entries on the bootclasspath.

Returns:
an int which is the number of entries on the bootclasspath

static byte [] com.ibm.oti.vm.VM.getPathFromClassPath int  index  )  [static, package]
 

Return the specified bootclasspath entry.

Parameters:
index the index of the bootclasspath entry
Returns:
a byte array containing the bootclasspath entry specified in the vm options


The documentation for this class was generated from the following file:
(c) Copyright 2005 The Apache Software Foundation or its licensors, as applicable.