use of com.ibm.dtfj.java.j9.JavaObject in project openj9 by eclipse.
the class NodeJavaVM method didFinishParsing.
public void didFinishParsing() {
Iterator classLoaders = _runtime.getJavaClassLoaders();
while (classLoaders.hasNext()) {
Object potentialClassLoader = classLoaders.next();
if (potentialClassLoader instanceof JavaClassLoader) {
JavaClassLoader loader = (JavaClassLoader) potentialClassLoader;
// sets the associated object
try {
Object potentialLoaderObject = loader.getObject();
if (null != potentialLoaderObject && potentialLoaderObject instanceof com.ibm.dtfj.java.j9.JavaObject) {
JavaObject loaderObject = (com.ibm.dtfj.java.j9.JavaObject) potentialLoaderObject;
loaderObject.setAssociatedClassLoader(loader);
_runtime.addSpecialObject(loaderObject);
Iterator classes = loader.getDefinedClasses();
while (classes.hasNext()) {
Object potentialClass = classes.next();
if (potentialClass instanceof JavaClass) {
JavaClass theClass = (JavaClass) potentialClass;
try {
Object potentialClassObject = theClass.getObject();
if (null != potentialClassObject && potentialClassObject instanceof com.ibm.dtfj.java.j9.JavaObject) {
JavaObject classObject = (com.ibm.dtfj.java.j9.JavaObject) potentialClassObject;
classObject.setAssociatedClass(theClass);
_runtime.addSpecialObject(classObject);
}
} catch (CorruptDataException e) {
// no reason to skip the other classloaders/classes just because an exception is thrown on one class
} catch (IllegalArgumentException e) {
// CMVC 173262 : JavaClass.getObject() uses JavaHeap.getObjectAtAddress() which can throw this exception
}
}
}
}
} catch (CorruptDataException e) {
// associated object not set
}
}
}
Iterator monitors = _runtime.getMonitors();
while (monitors.hasNext()) {
Object potentialMonitor = monitors.next();
if (potentialMonitor instanceof JavaMonitor) {
JavaMonitor monitor = (JavaMonitor) potentialMonitor;
// sets the associated object
Object potentialMonitorObject = monitor.getObject();
if (null != potentialMonitorObject && potentialMonitorObject instanceof com.ibm.dtfj.java.j9.JavaObject) {
JavaObject monitorObject = (com.ibm.dtfj.java.j9.JavaObject) potentialMonitorObject;
monitorObject.setAssociatedMonitor(monitor);
_runtime.addSpecialObject(monitorObject);
}
}
}
Iterator threads = _runtime.getThreads();
while (threads.hasNext()) {
Object potentialThread = threads.next();
if (potentialThread instanceof JavaThread) {
JavaThread thread = (JavaThread) potentialThread;
// sets the associated object
try {
Object potentialThreadObject = thread.getObject();
if (null != potentialThreadObject && potentialThreadObject instanceof com.ibm.dtfj.java.j9.JavaObject) {
JavaObject threadObject = (com.ibm.dtfj.java.j9.JavaObject) potentialThreadObject;
threadObject.setAssociatedThread(thread);
_runtime.addSpecialObject(threadObject);
}
} catch (CorruptDataException e) {
// associated object not set
}
}
}
}
Aggregations