javax.tools.diagnostics.runtime.java
Interface JavaRuntime

All Superinterfaces:
ManagedRuntime

public interface JavaRuntime
extends ManagedRuntime

Represents an instance of a Java Virtual Machine This interface defines attributes and features common across real implementation of the Java Virtual Machine. Not all of these characteristics are defined by the Java Virtual Machine Specification Notable additions beyond the JVM specification include Garbage Collection and access to the contents of the Heap or Heaps. Since this interface defines a view of the Java Runtime that is beyond that seen by the Java programmer during program execution it is necessarily more detailed.


Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.List<JavaMethod> getCompiledMethods()
          Get the set of JavaMethod objects that have been compiled.
 java.util.List<JavaReference> getHeapRoots()
          Get the complete set of object and class roots known to the Java Virtual Machine
 java.util.List<JavaHeap> getHeaps()
          Get the set of heaps known by the Java Virtual Machine There may be multiple heaps within a Java Virtual Machine, for instance a generational heap and a class heap.
 java.util.List<JavaClassLoader> getJavaClassLoaders()
          Get the set of class loaders available in this Java Virtual Machine instance.
 ImagePointer getJavaVM()
          Get the object that represents the virtual machine
 JavaVMInitArgs getJavaVMInitArgs()
          Fetch the JavaVMInitArgs which were used to create this VM.
 java.util.List<JavaMonitor> getMonitors()
          Provides access to the collection of monitors used in the Java Virtual Machine.
 JavaObject getObjectAtAddress(ImagePointer address)
          Gets the object located at address address in the heap.
 java.io.File getSource()
          Returns the File used as source for the creation of this Runtime.
 java.util.List<JavaThread> getThreads()
          Get the set of Java Threads that have been started Thread.start() in this Java Virtual Machine instance.
 java.lang.Object getTraceBuffer(java.lang.String bufferName, boolean formatted)
           
 int hashCode()
           
 
Methods inherited from interface javax.tools.diagnostics.runtime.ManagedRuntime
getFullVersion, getVersion
 

Method Detail

getJavaVM

ImagePointer getJavaVM()
                       throws CorruptDataException
Get the object that represents the virtual machine

Returns:
the address of the JavaVM structure which represents this JVM instance in JNI
Throws:
CorruptDataException

getJavaVMInitArgs

JavaVMInitArgs getJavaVMInitArgs()
                                 throws DataUnavailable,
                                        CorruptDataException
Fetch the JavaVMInitArgs which were used to create this VM. See JNI_CreateJavaVM in the JNI Specification for more details. A valid object is returned or an exception is thrown.

Returns:
the JavaVMInitArgs which were used to create this VM.
Throws:
DataUnavailable - if the arguments are not available
CorruptDataException - if the implementation was unexpectedly unable to retrieve the data

getJavaClassLoaders

java.util.List<JavaClassLoader> getJavaClassLoaders()
Get the set of class loaders available in this Java Virtual Machine instance.

Available in this context means class loaders that are participating in the class loader hierarchy. All class loaders are returned including any defined by the Java Virtual machine instance itself.

Any structural relationships between class loaders in this list is not exposed. Recreation of the class loader graph within a Java Virtual Machine instance is beyond the scope of the API.

At least one class loader must be returned in the resulting list.

The returned list follows the standard semantics for javax.tools.diagnostics collections

Returns:
a List of all of the class loaders within this Java Virtual Machine instance
See Also:
JavaClassLoader

getThreads

java.util.List<JavaThread> getThreads()
Get the set of Java Threads that have been started Thread.start() in this Java Virtual Machine instance. This method does not return all instances of java.lang.Thread contained within the system. Only threads that have been started and have not yet stopped or exited are returned. Threads may not be in an active state when returned by this method. The returned list follows the standard semantics for javax.tools.diagnostics collections The returned list is never null although it can be empty.

Returns:
a List of the JavaThreads in the runtime
See Also:
JavaThread

getCompiledMethods

java.util.List<JavaMethod> getCompiledMethods()
Get the set of JavaMethod objects that have been compiled. Compiled methods are methods that have been converted into native code by the Java Virtual Machine or related Just In Time Compiler There is no expectation that any method has been compiled. The returned list could be empty. However any JavaMethod reachable though the API which would return a non empty list for calls to JavaMethod.getCompiledSections() must be contained within the list returned by this method. The returned list follows the standard semantics for javax.tools.diagnostics collections

Returns:
a List of all of the JavaMethods in the JavaRuntime which have been compiled.
See Also:
JavaMethod

getMonitors

java.util.List<JavaMonitor> getMonitors()
Provides access to the collection of monitors used in the Java Virtual Machine. This collection can include monitors associated with managed objects (e.g. object monitors) and monitors associated with Java Virtual Machine internal control structures (e.g. raw monitors). Raw monitors are implementation specific. The returned list follows the standard semantics for javax.tools.diagnostics collections. The returned list is never null but could be empty.

Returns:
a list of monitors
See Also:
JavaMonitor, CorruptData

getHeaps

java.util.List<JavaHeap> getHeaps()
Get the set of heaps known by the Java Virtual Machine There may be multiple heaps within a Java Virtual Machine, for instance a generational heap and a class heap. Heaps may be specific to this Java Virtual Machine instance, or may be shared between multiple Java Virtual Machine instances.

The returned list follows the standard semantics for javax.tools.diagnostics collections.

The returned list is never null and will always contain at least one JavaHeap object

Returns:
a list for all of the Java heaps within this runtime.
See Also:
JavaHeap, CorruptData

getHeapRoots

java.util.List<JavaReference> getHeapRoots()
Get the complete set of object and class roots known to the Java Virtual Machine

Returns:
a list of JavaReferences representing the known global heap roots within this runtime. The returned list follows the standard semantics for javax.tools.diagnostics collections. The returned list is never null but can be empty.
See Also:
JavaReference, JavaStackFrame, CorruptData

getTraceBuffer

java.lang.Object getTraceBuffer(java.lang.String bufferName,
                                boolean formatted)
                                throws CorruptDataException
Parameters:
bufferName - a String naming the buffer to be fetched
formatted - true if formatting should be performed on the buffer, or false if the raw buffer contents should be returned
Returns:
an implementation specific result, depending on the parameters
Throws:
CorruptDataException

getObjectAtAddress

JavaObject getObjectAtAddress(ImagePointer address)
                              throws CorruptDataException,
                                     java.lang.IllegalArgumentException,
                                     MemoryAccessException,
                                     DataUnavailable
Gets the object located at address address in the heap.

Parameters:
addr - the ImagePointer instance representing the start address of object in the heap;
Returns:
the JavaObject instance representing the located object.
Throws:
java.lang.IllegalArgumentException - if address is null, outside the heap's boundaries or if it doesn't point to the start location of an object;
MemoryAccessException - if address is is in the heap but it's not accessible from the dump;
CorruptDataException - if any data needed to build the returned instance of JavaObject is corrupt.
DataUnavailable - if any data needed to build the returned instance of JavaObject is not available.
See Also:
JavaObject

equals

boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
true if the given object refers to the same Java Runtime in the image

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object

getSource

java.io.File getSource()
Returns the File used as source for the creation of this Runtime. This File will be equal to the file presented to the FactoryRegistry when this runtime (or its parent Image) was created.

Returns:
File object


Copyright © 2010. All Rights Reserved.