RFR: 8359936: StableValues can release the underlying function after complete computation [v4]
Viktor Klang
vklang at openjdk.org
Tue Aug 12 09:12:21 UTC 2025
On Mon, 11 Aug 2025 18:08:40 GMT, ExE Boss <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 174:
>>
>>> 172: // Reduce the counter and if it reaches zero, clear the reference
>>> 173: // to the underlying holder.
>>> 174: underlyingHolder.countDown();
>>
>> Doesn't the code here imply that if the underlying supplier/function etc throws an exception, the underlyingHolder won't get counted down, and will leak?
>
> No, because the stable value doesn’t get set in that case, so the supplier/function will be called again.
@ExE-Boss That seems to presume that 1) it will be called again, and 2) it will eventually produce a non-exception
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25878#discussion_r2269207579
More information about the core-libs-dev
mailing list