From 5289ecdd38047d67be5a199ff37ea69ac7c19c77 Mon Sep 17 00:00:00 2001 From: smarks Date: Thu, 5 Jul 2012 15:13:45 -0700 Subject: [PATCH] 7123972: test/java/lang/annotation/loaderLeak/Main.java fails intermittently Reviewed-by: dholmes, smarks Contributed-by: Eric Wang --- test/ProblemList.txt | 3 --- test/java/lang/annotation/loaderLeak/Main.java | 14 +++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 722949110..af875d9fb 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -122,9 +122,6 @@ # jdk_lang -# 7123972 -java/lang/annotation/loaderLeak/Main.java generic-all - # 6944188 java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all diff --git a/test/java/lang/annotation/loaderLeak/Main.java b/test/java/lang/annotation/loaderLeak/Main.java index dc835a9dc..fceda8195 100644 --- a/test/java/lang/annotation/loaderLeak/Main.java +++ b/test/java/lang/annotation/loaderLeak/Main.java @@ -57,9 +57,17 @@ public class Main { System.gc(); System.gc(); loader = null; - System.gc(); - System.gc(); - if (c.get() != null) throw new AssertionError(); + + // Might require multiple calls to System.gc() for weak-references + // processing to be complete. If the weak-reference is not cleared as + // expected we will hang here until timed out by the test harness. + while (true) { + System.gc(); + Thread.sleep(20); + if (c.get() == null) { + break; + } + } } } -- GitLab