Timeout the finalizer throw test if no finalization occurs.

This test will never complete if the objects intended for finalization
are not ready to be collected.  This condition occurs with the copying
collector.  Adding the timeout forces the test to fail and allows the
test suite to make forward progress.

Change-Id: I2abb0a2530755dd32a14ecf94b24a546fd1327a9
diff --git a/tests/059-finalizer-throw/src/Main.java b/tests/059-finalizer-throw/src/Main.java
index 0937361..f000d90 100644
--- a/tests/059-finalizer-throw/src/Main.java
+++ b/tests/059-finalizer-throw/src/Main.java
@@ -1,5 +1,7 @@
 // Copyright 2008 The Android Open Source Project
 
+import java.util.Timer;
+import java.util.TimerTask;
 
 /*
  * Throw an exception from a finalizer and make sure it's harmless.  Under
@@ -19,6 +21,13 @@
         System.gc();
         System.runFinalization();
 
+        new Timer().schedule(new TimerTask() {
+                public void run() {
+                    System.out.println("Timed out, exiting");
+                    System.exit(1);
+                }
+            }, 30000);
+
         while (!didFinal) {
             try {
                 Thread.sleep(500);
@@ -45,4 +54,3 @@
         throw new InterruptedException("whee");
     }
 }
-