RFR: 8302849: SurfaceManager might expose partially constructed object

Andrey Turbanov aturbanov at openjdk.org
Sat Feb 25 17:02:12 UTC 2023


On Mon, 20 Feb 2023 10:25:34 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes to add `volatile` to a variable declaration in order to prevent partially initialized objects to be observed by threads.
> 
> `SurfaceManager` is using a lazily initialized cacheMap that is initialized using a double-checked locking mechanism. Generally, objects initialized using such constructs need to be declared volatile. 
> 
> See https://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java

Copyright year update seems forgotten.

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

PR: https://git.openjdk.org/jdk/pull/12654



More information about the client-libs-dev mailing list