On Thu, 2 Feb 2023 20:09:22 GMT, Mandy Chung <mch...@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. test/lib/jdk/test/lib/util/ForceGC.java line 73: > 71: * if did not complete after the specified waiting time. > 72: */ > 73: public static boolean wait(BooleanSupplier booleanSupplier, long > timeout) { Can the method name be changed to make it clear the timeout is not scaled by the TIMEOUT factor. (It would have been better if the original method name mentioned the timeout factor). How about, `waitNoMoreThan`. ------------- PR: https://git.openjdk.org/jdk/pull/12392