- java.lang.Object
-
- com.ibm.dtfj.java.javacore.JCJavaRuntime
-
- All Implemented Interfaces:
JavaRuntime,ManagedRuntime
public class JCJavaRuntime extends Object implements JavaRuntime
A javacore-based implementation of JavaRuntime. This supports partial object creation, meaning that a javaclass, javathread, etc.. can be partially constructed and stored, and at a later time during the javacore parsing, when more information is available, existing javaclasses, javathreads, and so on can be looked up and data added.
However, all partial objects must contain at least one immutable field. See the implementation of each runtime component for more information.
Rudimentary multiplatform support is also added in the form of unique runtime ids that must be passed during construction.- See Also:
JCJavaClass,JCJavaClassLoader,JCJavaThread,JCJavaMonitor,JavaRuntime
-
-
Constructor Summary
Constructors Constructor Description JCJavaRuntime(JCImageProcess imageProcess, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJavaClass(JCJavaClass javaClass)NON-DTFJ
For internal building purposes only.voidaddJavaClassLoader(JCJavaClassLoader javaClassLoader)NON-DTFJ
For internal building purposes only.voidaddJavaThread(JCJavaThread javaThread)NON-DTFJ
For internal building purposes only.voidaddJavaVMInitArgs(JCJavaVMInitArgs args)NON-DTFJ
For internal building purposes only.voidaddJITProperty(String name, String value)voidaddMonitor(JCJavaMonitor monitor)NON-DTFJ
For internal building purposes only.voidaddTopLevelMemoryCategory(JCJavaRuntimeMemoryCategory category)JCJavaClassfindJavaClass(long id)NON-DTFJ
For internal building purposes only.JCJavaClassfindJavaClass(String javaClassName)NON-DTFJ
For internal building purposes only.JCJavaClassLoaderfindJavaClassLoader(long clLoaderID)NON-DTFJ
For internal building purposes only.JCJavaThreadfindJavaThread(long threadID)NON-DTFJ
For internal building purposes only.JCJavaMonitorfindMonitor(long id)NON-DTFJ
For internal building purposes only.IteratorgetCompiledMethods()This is short cut method.StringgetFullVersion()Get the 'full' version information for this runtime.IteratorgetHeaps()Get the set of heaps known by the VMJCImageProcessgetImageProcess()NON-DTFJ
For internal building purposes only.StringgetInternalID()NON-DTFJ
For internal building purposes only.IteratorgetJavaClassLoaders()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.IteratorgetMonitors()Provides access to the collection of monitors used in the JavaVM.IteratorgetThreads()Get the set of Java threads known by the VMObjectgetTraceBuffer(String arg0, boolean arg1)Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) bufferStringgetVersion()Get the version data available for this runtime instance.voidsetJITEnabled(boolean enabled)voidsetStartTime(long startTime)voidsetStartTimeNanos(long nanoTime)voidsetVersion(String version)NON-DTFJ
For internal building purposes only.-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods declared in interface com.ibm.dtfj.java.JavaRuntime
equals, getHeapRoots, getJITProperties, getMemoryCategories, getMemorySections, getObjectAtAddress, getStartTime, getStartTimeNanos, getSystemProperty, hashCode, isJITEnabled
-
-
-
-
Constructor Detail
-
JCJavaRuntime
public JCJavaRuntime(JCImageProcess imageProcess, String id) throws JCInvalidArgumentsException
- Throws:
JCInvalidArgumentsException
-
-
Method Detail
-
getCompiledMethods
public Iterator getCompiledMethods()
Description copied from interface:JavaRuntimeThis is short cut method. The same result can be found by iterating over all methods in all class loaders in all classes.- Specified by:
getCompiledMethodsin interfaceJavaRuntime- Returns:
- an iterator over all of the JavaMethods in the JavaRuntime which have been compiled
- See Also:
JavaRuntime.getCompiledMethods()
-
getHeaps
public Iterator getHeaps()
Description copied from interface:JavaRuntimeGet the set of heaps known by the VM- Specified by:
getHeapsin interfaceJavaRuntime- 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:
JavaRuntime.getHeaps()
-
getJavaClassLoaders
public Iterator getJavaClassLoaders()
Description copied from interface:JavaRuntimeGet the set of class loaders active in this VM- Specified by:
getJavaClassLoadersin interfaceJavaRuntime- Returns:
- an iterator of all of the class loaders within this JavaVM
- See Also:
JavaRuntime.getJavaClassLoaders()
-
getMonitors
public Iterator getMonitors()
Description copied from interface:JavaRuntimeProvides 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)- Specified by:
getMonitorsin interfaceJavaRuntime- Returns:
- an iterator over the collection of monitors
- See Also:
JavaRuntime.getMonitors()
-
getThreads
public Iterator getThreads()
Description copied from interface:JavaRuntimeGet the set of Java threads known by the VM- Specified by:
getThreadsin interfaceJavaRuntime- Returns:
- an iterator of the JavaThreads in the runtime
- See Also:
JavaRuntime.getThreads()
-
getJavaVMInitArgs
public JavaVMInitArgs getJavaVMInitArgs() throws DataUnavailable, CorruptDataException
Description copied from interface:JavaRuntimeFetch the JavaVMInitArgs which were used to create this VM. See JNI_CreateJavaVM in the JNI Specification for more details.- Specified by:
getJavaVMInitArgsin interfaceJavaRuntime- Returns:
- the JavaVMInitArgs which were used to create this VM.
- Throws:
DataUnavailable- if the arguments are not availableCorruptDataException- See Also:
JavaRuntime.getJavaVMInitArgs()
-
getJavaVM
public ImagePointer getJavaVM() throws CorruptDataException
Description copied from interface:JavaRuntimeGet the object that represents the virtual machine- Specified by:
getJavaVMin interfaceJavaRuntime- Returns:
- the address of the JavaVM structure which represents this JVM instance in JNI
- Throws:
CorruptDataException- See Also:
JavaRuntime.getJavaVM()
-
getTraceBuffer
public Object getTraceBuffer(String arg0, boolean arg1) throws CorruptDataException
Description copied from interface:JavaRuntimeFetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) buffer- Specified by:
getTraceBufferin interfaceJavaRuntime- Parameters:
arg0- a String naming the buffer to be fetchedarg1- 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- See Also:
com.ibm.dtfj.java.JavaRuntime#getTraceBuffer()
-
getFullVersion
public String getFullVersion() throws CorruptDataException
Description copied from interface:ManagedRuntimeGet the 'full' version information for this runtime.- Specified by:
getFullVersionin interfaceManagedRuntime- Returns:
- a string representation of the version information for this runtime instance
- Throws:
CorruptDataException- If the runtime presents no understandable version data- See Also:
ManagedRuntime.getFullVersion()
-
getVersion
public String getVersion() throws CorruptDataException
Description copied from interface:ManagedRuntimeGet the version data available for this runtime instance.- Specified by:
getVersionin interfaceManagedRuntime- Returns:
- a string representing all the version data available for this runtime instance.
- Throws:
CorruptDataException- If the runtime presents no understandable version data- See Also:
ManagedRuntime.getVersion()
-
getInternalID
public String getInternalID()
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.
May be used in multiple runtime environments, where each runtime in a javacore is identified uniquely. This method is generally just used during the building process only.
-
addJavaClassLoader
public void addJavaClassLoader(JCJavaClassLoader javaClassLoader) throws JCInvalidArgumentsException
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
javaClassLoader-- Throws:
JCRegistrationFailureException- if invalid class loader passed.JCInvalidArgumentsException
-
findJavaClassLoader
public JCJavaClassLoader findJavaClassLoader(long clLoaderID)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
javaClassLoaderName-- Returns:
- javaclassloader if found or null
-
addMonitor
public void addMonitor(JCJavaMonitor monitor) throws JCInvalidArgumentsException
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
monitor- must not be null- Throws:
JCRegistrationFailureException- if invalid monitor passed.JCInvalidArgumentsException
-
findMonitor
public JCJavaMonitor findMonitor(long id)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
id-- Returns:
- found java monitor or null
-
addJavaThread
public void addJavaThread(JCJavaThread javaThread) throws JCInvalidArgumentsException
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
javaThread- must not be null.- Throws:
JCRegistrationFailureException- if java thread is nullJCInvalidArgumentsException
-
findJavaThread
public JCJavaThread findJavaThread(long threadID)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.
In most cases, the threadID is the tid in a javacore, but in some other occasions, the id passed could be the system_thread_id or even the native thread. If a java thread is not found via tid, see if it can be found indirectly by an image thread that may be associated with the java thread (the image thread has a system thread ID as well as a native thread ID).- Parameters:
threadID- usually, tid in a javacore, may be id of some other internal vm datastructure.- Returns:
- found java thread or null.
-
getImageProcess
public JCImageProcess getImageProcess()
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Returns:
- image process containing this java runtime. This should never be null.
-
addJavaClass
public void addJavaClass(JCJavaClass javaClass) throws JCInvalidArgumentsException
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.
Two separate maps are kept for classes. One based on class ID, the other based on class name. Both are used for lookups while building the runtime object. When a valid javaclass is added, it gets added at least the name-based map, and may be added to the ID-based map if the ID is available. The class name of the java class is a requirement, so this field must be set in the java class being passed.- Parameters:
javaClass- must not be null or exception thrown- Throws:
JCRegistrationFailureException- if java class is nullJCInvalidArgumentsException
-
findJavaClass
public JCJavaClass findJavaClass(String javaClassName)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
javaClassName-- Returns:
- found class or null if not found
-
findJavaClass
public JCJavaClass findJavaClass(long id)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.
In some cases, all that is available is a class ID, so it should be possible to retrieve a class based on just an ID.- Parameters:
id- class address- Returns:
- found class or null if not found
-
addJavaVMInitArgs
public void addJavaVMInitArgs(JCJavaVMInitArgs args) throws JCInvalidArgumentsException
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
args- , must not be null- Throws:
JCRegistrationFailureException- if invalid args passed.JCInvalidArgumentsException
-
setVersion
public void setVersion(String version)
NON-DTFJ
For internal building purposes only. Do not call outside the DTFJ implementation.- Parameters:
args- , the version string
-
addTopLevelMemoryCategory
public void addTopLevelMemoryCategory(JCJavaRuntimeMemoryCategory category)
-
setJITEnabled
public void setJITEnabled(boolean enabled)
-
setStartTime
public void setStartTime(long startTime)
-
setStartTimeNanos
public void setStartTimeNanos(long nanoTime)
-
-