- 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 void
addJavaClass(JCJavaClass javaClass)
NON-DTFJ
For internal building purposes only.void
addJavaClassLoader(JCJavaClassLoader javaClassLoader)
NON-DTFJ
For internal building purposes only.void
addJavaThread(JCJavaThread javaThread)
NON-DTFJ
For internal building purposes only.void
addJavaVMInitArgs(JCJavaVMInitArgs args)
NON-DTFJ
For internal building purposes only.void
addJITProperty(String name, String value)
void
addMonitor(JCJavaMonitor monitor)
NON-DTFJ
For internal building purposes only.void
addTopLevelMemoryCategory(JCJavaRuntimeMemoryCategory category)
JCJavaClass
findJavaClass(long id)
NON-DTFJ
For internal building purposes only.JCJavaClass
findJavaClass(String javaClassName)
NON-DTFJ
For internal building purposes only.JCJavaClassLoader
findJavaClassLoader(long clLoaderID)
NON-DTFJ
For internal building purposes only.JCJavaThread
findJavaThread(long threadID)
NON-DTFJ
For internal building purposes only.JCJavaMonitor
findMonitor(long id)
NON-DTFJ
For internal building purposes only.Iterator
getCompiledMethods()
This is short cut method.String
getFullVersion()
Get the 'full' version information for this runtime.Iterator
getHeaps()
Get the set of heaps known by the VMJCImageProcess
getImageProcess()
NON-DTFJ
For internal building purposes only.String
getInternalID()
NON-DTFJ
For internal building purposes only.Iterator
getJavaClassLoaders()
Get the set of class loaders active in this VMImagePointer
getJavaVM()
Get the object that represents the virtual machineJavaVMInitArgs
getJavaVMInitArgs()
Fetch the JavaVMInitArgs which were used to create this VM.Iterator
getMonitors()
Provides access to the collection of monitors used in the JavaVM.Iterator
getThreads()
Get the set of Java threads known by the VMObject
getTraceBuffer(String arg0, boolean arg1)
Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) bufferString
getVersion()
Get the version data available for this runtime instance.void
setJITEnabled(boolean enabled)
void
setStartTime(long startTime)
void
setStartTimeNanos(long nanoTime)
void
setVersion(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:JavaRuntime
This is short cut method. The same result can be found by iterating over all methods in all class loaders in all classes.- Specified by:
getCompiledMethods
in 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:JavaRuntime
Get the set of heaps known by the VM- Specified by:
getHeaps
in 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:JavaRuntime
Get the set of class loaders active in this VM- Specified by:
getJavaClassLoaders
in 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:JavaRuntime
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)- Specified by:
getMonitors
in interfaceJavaRuntime
- Returns:
- an iterator over the collection of monitors
- See Also:
JavaRuntime.getMonitors()
-
getThreads
public Iterator getThreads()
Description copied from interface:JavaRuntime
Get the set of Java threads known by the VM- Specified by:
getThreads
in 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:JavaRuntime
Fetch the JavaVMInitArgs which were used to create this VM. See JNI_CreateJavaVM in the JNI Specification for more details.- Specified by:
getJavaVMInitArgs
in 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:JavaRuntime
Get the object that represents the virtual machine- Specified by:
getJavaVM
in 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:JavaRuntime
Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) buffer- Specified by:
getTraceBuffer
in 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:ManagedRuntime
Get the 'full' version information for this runtime.- Specified by:
getFullVersion
in 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:ManagedRuntime
Get the version data available for this runtime instance.- Specified by:
getVersion
in 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)
-
-