Skip to content

Commit 6c55e17

Browse files
author
duke
committedMar 21, 2023
Automatic merge of jdk:master into master
2 parents 39dc57d + 0deb648 commit 6c55e17

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed
 

‎test/jdk/ProblemList-svc-vthread.txt

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ com/sun/jdi/StepTest.java 8285422 generic-all
5454
com/sun/jdi/redefine/RedefineTest.java 8285422 generic-all
5555
com/sun/jdi/redefineMethod/RedefineTest.java 8285422 generic-all
5656

57-
com/sun/jdi/InvokeHangTest.java 8290200 macosx-x64,windows-x64
58-
5957
####
6058
# JDI SDE Tests
6159
# Use custom classpath

‎test/jdk/com/sun/jdi/InvokeHangTest.java

+18-6
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,23 @@ public static void main(String[] args) {
5959

6060
t1.start();
6161
t2.start();
62+
63+
try {
64+
// The join ensures that the test completes before we exit main(). If we are using
65+
// virtual threads, they are always daemon threads, and therefore the JVM will exit
66+
// while they are still running (and the test has not yet completed). The join
67+
// isn't really needed for platform threads, since by default they are not
68+
// daemon threads, but it doesn't hurt any either.
69+
t1.join();
70+
t2.join();
71+
} catch (InterruptedException e) {
72+
throw new RuntimeException(e);
73+
}
6274
}
6375

6476
// This is called from the debugger via invokeMethod
6577
public double invokeee() {
66-
System.out.println("Debuggee: invokeee in thread "+Thread.currentThread().toString());
78+
System.out.println("Debuggee: invokeee in thread " + Thread.currentThread().toString());
6779
Thread.yield();
6880
return longMethod(2);
6981
}
@@ -145,9 +157,9 @@ void doInvoke(ThreadReference thread, ObjectReference ref, String methodName) {
145157
List methods = ref.referenceType().methodsByName(methodName);
146158
Method method = (Method) methods.get(0);
147159
try {
148-
System.err.println(" Debugger: Invoking in thread" + thread);
160+
System.out.println(" Debugger: Invoking in thread " + thread);
149161
ref.invokeMethod(thread, method, new ArrayList(), ref.INVOKE_NONVIRTUAL);
150-
System.err.println(" Debugger: Invoke done");
162+
System.out.println(" Debugger: Invoke done");
151163
} catch (Exception ex) {
152164
ex.printStackTrace();
153165
failure("failure: Exception");
@@ -191,7 +203,7 @@ public void breakpointReached(BreakpointEvent event) {
191203
ThreadReference thread = event.thread();
192204
try {
193205
StackFrame sf = thread.frame(0);
194-
System.err.println(" Debugger: Breakpoint hit at "+sf.location());
206+
System.out.println(" Debugger: Breakpoint hit at " + sf.location());
195207
doInvoke(thread, sf.thisObject(), "invokeee");
196208
} catch (IncompatibleThreadStateException itsex) {
197209
itsex.printStackTrace();
@@ -214,7 +226,7 @@ protected void runTests() throws Exception {
214226
targetClass = bpe.location().declaringType();
215227
mainThread = bpe.thread();
216228
EventRequestManager erm = vm().eventRequestManager();
217-
final Thread mainThread = Thread.currentThread();
229+
final Thread mainTestThread = Thread.currentThread();
218230

219231
/*
220232
* Set event requests
@@ -246,7 +258,7 @@ public void run() {
246258
vmDisconnected = true;
247259
// This awakens the main thread which is
248260
// waiting for a VMDisconnect.
249-
mainThread.interrupt();
261+
mainTestThread.interrupt();
250262
break;
251263
}
252264
myBkpts = bkpts;

0 commit comments

Comments
 (0)
Please sign in to comment.