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

Roger Riggs rriggs at openjdk.org
Wed Feb 8 23:18:46 UTC 2023


On Wed, 8 Feb 2023 23:17:20 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.
>
> Mandy Chung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8301704
>  - Rename the new method to waitFor
>  - JDK-8301704: Shorten the number of GCs in UnloadingTest.java to verify a strongly reachable object not being unloaded

LGTM

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

Marked as reviewed by rriggs (Reviewer).

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


More information about the core-libs-dev mailing list