On Sat, 5 Mar 2022 14:20:40 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

> will now try and update/use this cached class level static state DFS. That 
> would thus require some kind of thread safety semantics to be implemented for 
> this new getDecimalFormatSymbols(Locale) method, isn't it?

A bit more closer look at the code and it appears to me that the use of :

DecimalFormatSymbols dfs = DFS;

and then working off that local variable prevents any kind of race issues that 
might be caused due to multi-thread access. Of course it still means that 
multiple threads might still go ahead and do a:

dfs = DecimalFormatSymbols.getInstance(locale);

on first access (when `DFS` is null) but that in itself should be harmless.

If this is intentional (which I suspect it is), should some comment be added in 
this method explaining this multi-thread access detail?

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

PR: https://git.openjdk.java.net/jdk/pull/7703

Reply via email to