Use `Reference.refersTo` API to get more up to date liveness info of a class after OOM is thrown. The approach of relying `Cleaner` thread can incur some "asynchronous" cause various retrying logic, complicating the flow.
The failure rate is ~60% before the fix and no failure for 2000 runs. Test: tier1-5 ------------- Commit messages: - test-unload Changes: https://git.openjdk.org/jdk/pull/27840/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27840&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8342659 Stats: 42 lines in 2 files changed: 8 ins; 27 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/27840.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27840/head:pull/27840 PR: https://git.openjdk.org/jdk/pull/27840
