On Fri, 27 Feb 2026 13:11:10 GMT, Daniel Gredler <[email protected]> wrote:

> I'm not sure about the thread safety of `cacheRef`. Is there a reason that 
> it's not declared final and initialized immediately in the declaration? It's 
> inside of `SDCache`, so it wouldn't be initialized unless needed anyway 
> (nested static class lazy init).

It can't be final. Because if it is cleared it will need to be re-created.
If 2 threads happen to create the CacheRef and one is dropped it should not 
matter.
My understanding is that reference assignments are atomic so that should be OK 
too.
All pre-existing anyway.

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

PR Comment: https://git.openjdk.org/jdk/pull/29904#issuecomment-3978352359

Reply via email to