test/jdk/java/util/zip/ZipFile/FinalizeZipFile.java
changeset 48238 9f225d4387e2
parent 47216 71c04702a3d5
--- a/test/jdk/java/util/zip/ZipFile/FinalizeZipFile.java	Mon Dec 11 18:33:53 2017 +0100
+++ b/test/jdk/java/util/zip/ZipFile/FinalizeZipFile.java	Mon Dec 11 11:45:02 2017 -0800
@@ -31,6 +31,7 @@
 import java.util.Random;
 import java.util.zip.*;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 public class FinalizeZipFile {
 
@@ -78,10 +79,9 @@
 
     public static void realMain(String[] args) throws Throwable {
         makeGarbage();
-
-        System.gc();
-        finalizersDone.await();
-
+        while (!finalizersDone.await(10, TimeUnit.MILLISECONDS)) {
+            System.gc();
+        }
         // Not all ZipFiles were collected?
         equal(finalizersDone.getCount(), 0L);
     }