jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 1 | // Copyright 2007 The Android Open Source Project |
| 2 | |
| 3 | /** |
| 4 | * Test a class with a bad finalizer. |
| 5 | */ |
| 6 | public class Main { |
| 7 | public static void main(String[] args) { |
| 8 | BadFinalizer bf = new BadFinalizer(); |
| 9 | |
| 10 | System.out.println("Constructed object."); |
| 11 | bf = null; |
| 12 | |
| 13 | System.out.println("Nulled. Requestion gc."); |
| 14 | System.gc(); |
| 15 | |
| 16 | for (int i = 0; i < 8; i++) { |
Elliott Hughes | 5f9298a | 2011-10-06 14:20:20 -0700 | [diff] [blame] | 17 | BadFinalizer.snooze(4000); |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 18 | System.out.println("Requesting another GC."); |
| 19 | System.gc(); |
| 20 | } |
| 21 | |
| 22 | System.out.println("Done waiting."); |
| 23 | System.exit(0); |
| 24 | } |
| 25 | } |