Remove something I missed.

This commit is contained in:
Coleen Phillimore 2026-07-31 13:15:07 +00:00
parent 85f6f24fb5
commit 73f23abe55
2 changed files with 15 additions and 21 deletions

View File

@ -45,8 +45,6 @@ import jdk.test.lib.dcmd.JMXExecutor;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Pattern;
public class PrintRawMonitorLockTest {
@ -117,20 +115,22 @@ public class PrintRawMonitorLockTest {
// Wait for threads to get ready.
waitForBarrier(readyBarrier);
OutputAnalyzer output;
// Execute dcmd in a loop in case the threads haven't deadlocked yet.
while (true) {
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
}
output = executor.execute("Thread.print -l=true");
if (output.getOutput().contains("Found 1 deadlock")) {
break;
OutputAnalyzer output = executor.execute("Thread.print -l=true");
if (!output.getOutput().contains("Found 1 deadlock")) {
// Execute dcmd in a loop in case the threads haven't deadlocked yet.
// Fail after 100 iterations. That's all it should take unless something is wrong.
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
}
// try again, otherwise java thinks it's not initialized.
output = executor.execute("Thread.print -l=true");
if (output.getOutput().contains("Found 1 deadlock")) {
break;
}
}
}
output.shouldContain("waiting to lock JVM TI raw monitor");
}

View File

@ -23,6 +23,7 @@
#include <string.h>
#include "jvmti.h"
#include "jvmti_common.hpp"
extern "C" {
@ -33,13 +34,6 @@ static char threadLockName1[] = "threadLock1";
static jrawMonitorID threadLock2 = nullptr;
static char threadLockName2[] = "threadLock2";
#define LOG(...) \
do { \
printf(__VA_ARGS__); \
printf("\n"); \
fflush(stdout); \
} while (0)
JNIEXPORT jint JNICALL
Java_PrintRawMonitorLockTest_createRawMonitors(JNIEnv *jni, jclass cls) {
if (jvmti->CreateRawMonitor(threadLockName1, &threadLock1) != JNI_OK) {