`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. ------------- Commit messages: - JDK-8301704: Shorten the number of GCs in UnloadingTest.java to verify a strongly reachable object not being unloaded Changes: https://git.openjdk.org/jdk/pull/12392/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12392&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8301704 Stats: 29 lines in 2 files changed: 25 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/12392.diff Fetch: git fetch https://git.openjdk.org/jdk pull/12392/head:pull/12392 PR: https://git.openjdk.org/jdk/pull/12392