On Fri, 6 Sep 2024 14:06:08 GMT, Viktor Klang <vkl...@openjdk.org> wrote:
>> 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. @viktorklang-ora: I added additional comments on the lock Object to clarify the purpose of the lock. See: https://github.com/openjdk/jdk/pull/20301/commits/dc0bd1552ea14adaec4cc8e67d4213826c1b175c. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1752651175