On Fri, 20 Nov 2026 07:53:07 GMT, Serguei Spitsyn <[email protected]> wrote:

>> Markus Grönlund has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Read–validate–retry to obtain a consistent snapshot.
>
> test/jdk/java/lang/management/ClassLoadingMXBean/RedefinitionCounts.java line 
> 81:
> 
>> 79:         return new Counts(CLASS_LOADING.getLoadedClassCount(),
>> 80:                           CLASS_LOADING.getTotalLoadedClassCount(),
>> 81:                           CLASS_LOADING.getUnloadedClassCount());
> 
> Does the `readCounts()` method need any kind of sync? Can a class unload 
> happen between these three separate MXBean calls? If so, we may observe 
> intermittent failures. You could read `Total` and `Unloaded` counts before 
> and after read of `Loaded` count and retry it if the counts before and after 
> are not equal.

Good observation, Serguei. Please see the update.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33973#discussion_r4640957278

Reply via email to