Integrated: JDK-8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded

Mandy Chung mchung at openjdk.org
Thu Feb 9 00:40:49 UTC 2023


On Thu, 2 Feb 2023 20:09:22 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> `test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java` defines hidden classes and verify cases that a class loader is not unloaded using `ForceGC::wait`.    ForceGC::wait` defaults the timeout to 1000ms * jtreg timeout factor, which is designed to work well to expect an object being reclaimed, i.e. the boolean supplier returns true.   On the other hand, if the boolean supplier never returns true, the method returns after it timeouts which may be long depending on the timeout factor. 
> 
> This PR adds a variant of `ForceGC::wait` to take a timeout parameter and tests can specify the timeout to reduce the time it takes testing a strongly reachable object not being reclaimed.

This pull request has now been integrated.

Changeset: c8cc7b67
Author:    Mandy Chung <mchung at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/c8cc7b67dbb4633e365a5d6e44419775ebce9d4a
Stats:     36 lines in 2 files changed: 29 ins; 0 del; 7 mod

8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded

Reviewed-by: rriggs

-------------

PR: https://git.openjdk.org/jdk/pull/12392


More information about the core-libs-dev mailing list