-
- All Superinterfaces:
ManagedRuntime
public interface JavaRuntime extends ManagedRuntime
Represents a Java runtime.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanequals(Object obj)Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.IteratorgetCompiledMethods()This is short cut method.IteratorgetHeapRoots()Get the set of object and class roots known to the VM.IteratorgetHeaps()Get the set of heaps known by the VMIteratorgetJavaClassLoaders()Get the set of class loaders active in this VMImagePointergetJavaVM()Get the object that represents the virtual machineJavaVMInitArgsgetJavaVMInitArgs()Fetch the JavaVMInitArgs which were used to create this VM.PropertiesgetJITProperties()Get any vendor specific properties in use by the JIT for this Java runtimeIteratorgetMemoryCategories()Returns iterator of the top-level memory categories used by this Java runtime.IteratorgetMemorySections(boolean includeFreed)Returns an iterator of JavaRuntimeMemorySection objects corresponding to the blocks of memory allocated by the JavaRuntime.IteratorgetMonitors()Provides access to the collection of monitors used in the JavaVM.JavaObjectgetObjectAtAddress(ImagePointer address)Gets the object located at addressaddressin the heap.longgetStartTime()Get the time when the JVM was started.longgetStartTimeNanos()Get the value of the JVM's high-resolution timer when the JVM was started.default StringgetSystemProperty(String key)Get a system property of the virtual machine.IteratorgetThreads()Get the set of Java threads known by the VMObjectgetTraceBuffer(String bufferName, boolean formatted)Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) bufferinthashCode()Answers an integer hash code for the receiver.booleanisJITEnabled()Determine if the JIT was enabled for this Java runtime.-
Methods declared in interface com.ibm.dtfj.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
-
getSystemProperty
default String getSystemProperty(String key) throws DataUnavailable, CorruptDataException
Get a system property of the virtual machine.- Parameters:
key- the name of the property to retrieve- Returns:
- the value of the requested system property from this VM
- Throws:
DataUnavailable- if the system properties are not availableCorruptDataException
-
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.- Returns:
- the JavaVMInitArgs which were used to create this VM.
- Throws:
DataUnavailable- if the arguments are not availableCorruptDataException
-
getJavaClassLoaders
Iterator getJavaClassLoaders()
Get the set of class loaders active in this VM- Returns:
- an iterator of all of the class loaders within this JavaVM
- See Also:
JavaClassLoader,CorruptData
-
getThreads
Iterator getThreads()
Get the set of Java threads known by the VM- Returns:
- an iterator of the JavaThreads in the runtime
- See Also:
JavaThread,CorruptData
-
getCompiledMethods
Iterator getCompiledMethods()
This is short cut method. The same result can be found by iterating over all methods in all class loaders in all classes.- Returns:
- an iterator over all of the JavaMethods in the JavaRuntime which have been compiled
- See Also:
JavaMethod,CorruptData
-
getMonitors
Iterator getMonitors()
Provides access to the collection of monitors used in the JavaVM. This collection includes both monitors associated with managed objects (e.g. object monitors) and monitors associated with internal control structures (e.g. raw monitors)- Returns:
- an iterator over the collection of monitors
- See Also:
JavaMonitor,CorruptData
-
getHeaps
Iterator getHeaps()
Get the set of heaps known by the VM- Returns:
- an iterator for all of the Java heaps within this runtime. Heaps may be specific to this JavaVM instance, or may be shared between multiple JavaVM instances
- See Also:
JavaHeap,CorruptData
-
getHeapRoots
Iterator getHeapRoots()
Get the set of object and class roots known to the VM. Stack frame roots are not included in the set, they can be retrieved using JavaStackFrame.getHeapRoots().- Returns:
- an iterator over the collection of JavaReferences representing the known global heap roots within this runtime.
- See Also:
JavaReference,JavaStackFrame,CorruptData
-
getTraceBuffer
Object getTraceBuffer(String bufferName, boolean formatted) throws CorruptDataException
Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) buffer- Parameters:
bufferName- a String naming the buffer to be fetchedformatted- 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, IllegalArgumentException, MemoryAccessException, DataUnavailable
Gets the object located at addressaddressin the heap.- Parameters:
address- theImagePointerinstance representing the start address of object in the heap;- Returns:
- the
JavaObjectinstance representing the located object. - Throws:
IllegalArgumentException- ifaddressis outside the heap's boundaries, or if it doesn't point to the start location of an object;MemoryAccessException- ifaddressis in the heap but it's not accessible from the dump;CorruptDataException- if any data needed to build the returned instance ofJavaObjectis corrupt.DataUnavailable- if any data needed to build the returned instance ofJavaObjectis not available.- See Also:
JavaObject
-
getMemoryCategories
Iterator getMemoryCategories() throws DataUnavailable
Returns iterator of the top-level memory categories used by this Java runtime.- Returns:
- Iterator of memory categories
- Throws:
DataUnavailable- Since:
- 1.5
- See Also:
CorruptData
-
getMemorySections
Iterator getMemorySections(boolean includeFreed) throws DataUnavailable
Returns an iterator of JavaRuntimeMemorySection objects corresponding to the blocks of memory allocated by the JavaRuntime.- Parameters:
includeFreed- If true, iterator will iterate over blocks of memory that have been freed, but haven't been re-used yet.- Returns:
- Iterator of memory sections.
- Throws:
DataUnavailable- Since:
- 1.5
- See Also:
CorruptData
-
equals
boolean equals(Object obj)
Description copied from class:ObjectCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. The implementation in Object answers true only if the argument is the exact same object as the receiver (==).- Overrides:
equalsin classObject- Parameters:
obj-- Returns:
- True if the given object refers to the same Java Runtime in the image
- See Also:
Object.hashCode()
-
hashCode
int hashCode()
Description copied from class:ObjectAnswers an integer hash code for the receiver. Any two objects which answertruewhen passed to.equalsmust answer the same value for this method.- Overrides:
hashCodein classObject- Returns:
- the receiver's hash.
- See Also:
Object.equals(java.lang.Object)
-
isJITEnabled
boolean isJITEnabled() throws DataUnavailable, CorruptDataExceptionDetermine if the JIT was enabled for this Java runtime.- Returns:
- true if the JIT was enabled, false if not
- Throws:
DataUnavailable- if it is not possible to determine the JIT statusCorruptDataException- Since:
- 1.8
-
getJITProperties
Properties getJITProperties() throws DataUnavailable, CorruptDataException
Get any vendor specific properties in use by the JIT for this Java runtime- Returns:
- the set of properties, which may be empty if none were set.
- Throws:
DataUnavailable- if the JIT was not enabled for this runtimeCorruptDataException- Since:
- 1.8
-
getStartTime
long getStartTime() throws DataUnavailable, CorruptDataExceptionGet the time when the JVM was started.- Returns:
- the time the JVM was started, in milliseconds since 1970
- Throws:
DataUnavailable- if the JVM start time is not availableCorruptDataException- if the JVM start time is corrupted- Since:
- 1.12
-
getStartTimeNanos
long getStartTimeNanos() throws DataUnavailable, CorruptDataExceptionGet the value of the JVM's high-resolution timer when the JVM was started.- Returns:
- the value of the high-resolution timer when the JVM was started, in nanoseconds
- Throws:
DataUnavailable- if the JVM start time is not availableCorruptDataException- if the JVM start time is corrupted- Since:
- 1.12
-
-