On Thu, 22 Aug 2024 21:05:09 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> Kevin Driver has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   addresses delayed provider selection where parameters are involved
>
> src/java.base/share/classes/javax/crypto/KDF.java line 104:
> 
>> 102: 
>> 103:     // The provider implementation (delegate)
>> 104:     private KDFSpi spi;
> 
> Given these two are always updated together, maybe we can group them in a 
> Record? Something like 
> 
>>     record Delegate(KDFSpi spi, Provider provider) {}
> 
> This way, you can merge spi+provider and firstSpi+firstProvider into 2 
> Delegate objects.
> Also, we only synchronize on the `lock` when setting the mutable fields such 
> as spi, we may have to mark the mutable fields volatile? I recall there is 
> some concurrency design patterns when doing lazy initialization.

Added the `record` in 
https://github.com/openjdk/jdk/pull/20301/commits/4a0bc0ef28ebbe8c5f22b3a5540725e3b4339c2e.
 Please review and indicate if resolved. Will investigate `volatile` separately.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1739225528

Reply via email to