use of com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator in project openj9 by eclipse.
the class VmCheckCommand method checkJ9VMThreadSanity.
/*
* Based on vmchk/checkthreads.c r1.5
*
* J9VMThread sanity:
* Valid VM check:
* J9VMThread->javaVM->javaVM == J9VMThread->javaVM.
*
* Exclusive access check:
* If any J9VMThread has exclusive access, ensure no other thread has exclusive or vm access.
*/
private void checkJ9VMThreadSanity(J9JavaVMPointer javaVM, PrintStream out) throws CorruptDataException {
GCVMThreadListIterator gcvmThreadListIterator = GCVMThreadListIterator.from();
int count = 0;
int numberOfThreadsWithVMAccess = 0;
boolean exclusiveVMAccess = javaVM.exclusiveAccessState().eq(J9_XACCESS_EXCLUSIVE);
reportMessage(out, "Checking threads");
while (gcvmThreadListIterator.hasNext()) {
J9VMThreadPointer thread = gcvmThreadListIterator.next();
verifyJ9VMThread(out, thread, javaVM);
if (thread.publicFlags().allBitsIn(J9Consts.J9_PUBLIC_FLAGS_VM_ACCESS)) {
numberOfThreadsWithVMAccess++;
}
count++;
}
if (exclusiveVMAccess && numberOfThreadsWithVMAccess > 1) {
reportError(out, "numberOfThreadsWithVMAccess (%d) > 1 with vm->exclusiveAccessState == J9_XACCESS_EXCLUSIVE", numberOfThreadsWithVMAccess);
}
reportMessage(out, "Checking %d threads done", count);
}
use of com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator in project openj9 by eclipse.
the class CheckVMThreads method print.
@Override
public void print() {
try {
GCVMThreadListIterator vmThreadListIterator = GCVMThreadListIterator.from();
ScanFormatter formatter = new ScanFormatter(this, "VMThread Slots");
while (vmThreadListIterator.hasNext()) {
J9VMThreadPointer walkThread = vmThreadListIterator.next();
formatter.section("thread", walkThread);
GCVMThreadIterator vmthreadIterator = GCVMThreadIterator.fromJ9VMThread(walkThread);
while (vmthreadIterator.hasNext()) {
formatter.entry(vmthreadIterator.next());
}
formatter.endSection();
}
formatter.end("VMThread Slots");
} catch (CorruptDataException e) {
// TODO: handle exception
}
}
use of com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator in project openj9 by eclipse.
the class DTFJJavaRuntime method getThreads.
@SuppressWarnings("rawtypes")
public Iterator getThreads() {
GCVMThreadListIterator threadIterator;
try {
threadIterator = GCVMThreadListIterator.from();
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
return corruptIterator(cd);
}
List<Object> toIterate = new LinkedList<Object>();
AddCorruptionToListListener listener = new AddCorruptionToListListener(toIterate);
register(listener);
try {
while (threadIterator.hasNext() && !listener.fatalCorruption()) {
J9VMThreadPointer next = threadIterator.next();
if (next != null) {
toIterate.add(new DTFJJavaThread(next));
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
toIterate.add(cd);
}
unregister(listener);
return toIterate.iterator();
}
Aggregations