* tests/regression/junit/Makefile.am (JAVACCMD): Added -source 1.5
[cacao.git] / tests / gc / ThreadJava.java
1 public class ThreadJava extends Thread {
2         public static final int N=5;
3         public static final int SLEEP=200;
4         public static final int LEN=20;
5
6         public void run() {
7                 while (true) {
8                         double d = Math.sqrt(Math.PI);
9                         String s = Double.toString(d);
10                         double e = Double.parseDouble(s);
11                         double f = Math.pow(e, 2);
12                         long  l1 = Math.round(f);
13                         long  l2 = Math.round(Math.PI);
14                         if (l1 != l2)
15                                 System.out.println("What is going on???");
16                 }
17         }
18
19         public static void main(String args[]) {
20                 ThreadJava t = null;
21
22                 System.out.println("Creating and starting threads ...");
23                 for (int i=0; i<N; i++) {
24                         t = new ThreadJava();
25                         t.start();
26                 }
27                 t = null;
28
29                 System.out.println("Sending Main-Thread to sleep ...");
30                 try {
31                         Thread.sleep(SLEEP);
32                 } catch (Exception e) {
33                         System.out.println("Exception while sleeping!");
34                 }
35
36                 System.out.println("Forcing a collection ...");
37                 System.gc();
38
39                 System.out.println("Finished.");
40         }
41 }