On Wed, 22 Jan 2025 17:09:54 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> Thanks Chen, made `available` volatile and implemented DCL in 
>> https://github.com/openjdk/jdk/pull/23165/commits/96e86c800f1d1af1c20bfee944c298f17b7e8860.
>> Also added a duplicate elements test as you suggested.
>
> I'm not sure how useful it is to optimize the performance of 
> `availableCurrencies` access to "available", but adding volatile will slow 
> every access down.
> The computation of the available currencies is stable, so a race computing it 
> is benign.
> Except for the available hashSet being partially filled when read by the 
> thread calling `getAvailableCurrencies()`.
> That could be remedied by using a new local for the new HashSet in 
> initAvailableCurrencies and assigning to available only when the set is 
> completely initialized.
> (And yes, this looks like a good fit for stable values.)

How about I revert the most recent commit and have this PR simply deliver the 
change to provide the stream of currencies. I'll file another issue to improve 
`available` to use stable values when that is available. Does that sound fine?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23165#discussion_r1925795274

Reply via email to