RFR: 8377950: Refactor ClassUnloader to provide explicit waiting API

Albert Mingkun Yang ayang at openjdk.org
Mon Feb 16 07:52:19 UTC 2026


Separates GC triggering from class reclamation waiting in vmTestbase ClassUnloader.

The original implementation used an implicit wait loop regardless of caller needs. Because the necessity of waiting is caller-specific, this PR introduces an explicit `unloadClassAndWait(timeout)` API. This allows callers to document their specific reasons for waiting (e.g., race conditions with JDWP or background compilation) while keeping `unloadClass()` simple for those who don't need to wait.

- Introduced `unloadClassAndWait(timeout)` and simplified `unloadClass()`.
- Updated `compmethunload001` and `AbstractDebuggeeTest` to use the explicit waiting API with documented rationale.

Test: tier1-5, `vmTestbase/nsk`

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

Commit messages:
 - jvmti-class-unload

Changes: https://git.openjdk.org/jdk/pull/29735/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29735&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377950
  Stats: 65 lines in 3 files changed: 38 ins; 19 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/29735.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29735/head:pull/29735

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


More information about the serviceability-dev mailing list