26
26
* @bug 8283044
27
27
* @requires vm.compiler1.enabled | vm.compiler2.enabled
28
28
* @summary Stress delivery of asynchronous exceptions.
29
- * @library /test/lib /test/hotspot/jtreg
30
- * @build AsyncExceptionTest
31
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xcomp
29
+ * @library /test/hotspot/jtreg/testlibrary
30
+ * @run main/othervm -Xcomp
32
31
-XX:CompileCommand=dontinline,AsyncExceptionTest::internalRun2
33
32
-XX:CompileCommand=compileonly,AsyncExceptionTest::internalRun1
34
33
-XX:CompileCommand=compileonly,AsyncExceptionTest::internalRun2
35
34
AsyncExceptionTest
36
35
*/
37
36
37
+ import jvmti .JVMTIUtils ;
38
+
38
39
import java .util .concurrent .CountDownLatch ;
39
40
40
41
public class AsyncExceptionTest extends Thread {
@@ -53,13 +54,17 @@ public void run() {
53
54
try {
54
55
internalRun1 ();
55
56
} catch (ThreadDeath td ) {
56
- throw new RuntimeException ("Catched ThreadDeath in run() instead of internalRun2() or internalRun1(). receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1 + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2 );
57
+ throw new RuntimeException ("Caught ThreadDeath in run() instead of internalRun2() or internalRun1().\n "
58
+ + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1
59
+ + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2 );
57
60
} catch (NoClassDefFoundError ncdfe ) {
58
- // ignore because we're testing Thread.stop () which can cause it
61
+ // ignore because we're testing StopThread () which can cause it
59
62
}
60
63
61
64
if (receivedThreadDeathinInternal2 == false && receivedThreadDeathinInternal1 == false ) {
62
- throw new RuntimeException ("Didn't catched ThreadDeath in internalRun2() nor in internalRun1(). receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1 + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2 );
65
+ throw new RuntimeException ("Didn't catch ThreadDeath in internalRun2() nor in internalRun1().\n "
66
+ + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1
67
+ + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2 );
63
68
}
64
69
exitSyncObj .countDown ();
65
70
}
@@ -120,7 +125,7 @@ public static void main(String[] args) {
120
125
thread .startSyncObj .await ();
121
126
while (true ) {
122
127
// Send async exception and wait until it is thrown
123
- thread . stop ( );
128
+ JVMTIUtils . stopThread ( thread );
124
129
thread .exitSyncObj .await ();
125
130
Thread .sleep (100 );
126
131
@@ -133,7 +138,7 @@ public static void main(String[] args) {
133
138
} catch (InterruptedException e ) {
134
139
throw new Error ("Unexpected: " + e );
135
140
} catch (NoClassDefFoundError ncdfe ) {
136
- // Ignore because we're testing Thread.stop() which can
141
+ // Ignore because we're testing StopThread which can
137
142
// cause it. Yes, a NoClassDefFoundError that happens
138
143
// in a worker thread can subsequently be seen in the
139
144
// main thread.
@@ -165,4 +170,3 @@ public static void usage() {
165
170
System .exit (1 );
166
171
}
167
172
}
168
-
0 commit comments