From 6a266c4de15d04d50928b68f9b2dbb69911cff13 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Fri, 7 Oct 2022 19:11:19 +0000 Subject: [PATCH] 8292879: com/sun/jdi/ClassUnloadEventTest.java failed due to classes not unloading Reviewed-by: dholmes, coleenp, sspitsyn --- test/jdk/com/sun/jdi/ClassUnloadEventTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/jdk/com/sun/jdi/ClassUnloadEventTest.java b/test/jdk/com/sun/jdi/ClassUnloadEventTest.java index 75181758055..a75f0dbd289 100644 --- a/test/jdk/com/sun/jdi/ClassUnloadEventTest.java +++ b/test/jdk/com/sun/jdi/ClassUnloadEventTest.java @@ -105,11 +105,20 @@ public class ClassUnloadEventTest { } } loader = null; + + // Do a short delay to make sure that the debug agent is done processing all + // ClassPrepare events. Otherwise the debug agent might still be holding on to + // a reference to a class, which will prevent it from unloading during the GC. + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + } + // Trigger class unloading ClassUnloadCommon.triggerUnloading(); - // Short delay to make sure all ClassUnloadEvents have been sent - // before VMDeathEvent is genareated. + // Do a short delay to make sure all ClassUnloadEvents have been sent + // before VMDeathEvent is generated. try { Thread.sleep(5000); } catch (InterruptedException e) {