On Mon, 16 Feb 2026 07:45:11 GMT, Albert Mingkun Yang <[email protected]> wrote:

> 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`

Seems reasonable. A couple of minor comments.

Thanks

test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java
 line 97:

> 95: 
> 96:         // BackgroundCompilation is on by default so wait for compiler 
> threads
> 97:         // to drop references to the to-be-unload class.

Suggestion:

        // to drop references to the to-be-unloaded class.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001.java
 line 98:

> 96:         // BackgroundCompilation is on by default so wait for compiler 
> threads
> 97:         // to drop references to the to-be-unload class.
> 98:         if (!clsUnLoader.unloadClassAndWait(10_000)) {

Why 10_000 when the implicit timeout was 10 * 100 ?

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

PR Review: https://git.openjdk.org/jdk/pull/29735#pullrequestreview-3811557964
PR Review Comment: https://git.openjdk.org/jdk/pull/29735#discussion_r2814882058
PR Review Comment: https://git.openjdk.org/jdk/pull/29735#discussion_r2814890352

Reply via email to