On Mon, 13 Jun 2022 22:37:52 GMT, Mandy Chung <mch...@openjdk.org> wrote:
>> Xue-Lei Andrew Fan has updated the pull request with a new target base due >> to a merge or a rebase. The pull request now contains ten commits: >> >> - Merge >> - Merge master >> - Merge >> - add timeout parameter >> - rollback is not in this branch >> - rollback JDK-8287384 >> - back to wait 1 second >> - Remove trailing white space >> - 8287596: Reorg jdk.test.lib.util.ForceGC > > test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java line 224: > >> 222: >> 223: boolean tryUnload() { >> 224: return ForceGC.wait(() -> weakRef.get() == null, 1000L); > > This verifies that the reference will never become weakly unreachable, i.e. > it remains strongly reachable. > > I suggest to add a method default to 200ms (?) timeout scaled with the > timeout factor and expect the specified condition will never met. Maybe > call it `ForceGC.neverTrue(BooleanSupplier)`? Need to tune the base waiting > time; for example if timeout factor is 4, then total wait would be 800 ms. I see your points. When I changed the waiting time to 1 second scaled with timeout factor, it looks like safe to use the ForceGC.wait() method for either cleanup and non-cleanup checking. The default JTREG timeout for a test case is 120 seconds. 1 seconds may be small enough so that we could use it for both cases. ------------- PR: https://git.openjdk.org/jdk/pull/8979