1 /*
2 * @test
3 * @bug 6434117
4 * @summary debug info for native methods illegally references register
5 * @run main/othervm -server -XX:+UseBiasedLocking TestNativeRevocation
6 */
7
8 import java.util.*;
9
10 public class TestNativeRevocation {
11 private static String tmp;
12
13 static class RevokerThread extends Thread {
14 private List queue = new ArrayList();
15
16 volatile boolean cont = true;
17 public void run() {
18 while (cont) {
19 synchronized (queue) {
20 if (queue.size() > 0) {
21 Throwable t = (Throwable) queue.remove(0);
22 synchronized (t) {
23 tmp = t.getMessage();
24 }
25 }
26 while (queue.size() == 0) {
27 try {
28 queue.wait();
29 } catch (InterruptedException e) {
30 cont = false;
31 }
32 }
33 }
34 }
35 }
36
37 public void give(Throwable t) {
38 synchronized (queue) {
39 queue.add(t);
40 queue.notifyAll();
41 }
42 }
43 }
44
45 public static void main(String[] args) {
46 RevokerThread revoker = new RevokerThread();
47 revoker.start();
48
49 // Warm up fillInStackTrace
50 for (int i = 0; i < 30000; i++) {
51 new Throwable();
52 }
53
54 // Start revocation
55 for (int i = 0; i < 1000000; i++) {
56 revoker.give(new Throwable());
57 if(i%100000 == 0)
58 System.out.println(i);
59 }
60 revoker.stop();
61 }
62 }