RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v10]

Viktor Klang vklang at openjdk.org
Fri Sep 6 14:11:21 UTC 2024


On Thu, 5 Sep 2024 17:50:19 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

>> I'd recommend documenting above this line what function the lock is intending to serve, and by each of the members that it guards accesses to. Something like "//guarded by 'lock'".
>> 
>> Also, ook into whether the members guarded by the lock needs `volatile`: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
>
> My understanding is that `volatile` is used when accessing the contents of the object, which we are not doing with this locking object, so IMO there is no reason for the keyword to be added.
> 
> I'll apply your other suggestion about explicit comments.

If the lock is used for double-checked locking the member which is lazily initialized needs `volatile` if the instance is not completely immutable.

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

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


More information about the security-dev mailing list