On Mon, 12 Jun 2023 14:35:15 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
> One thing though - WeakHashMap is not thread safe - and I don't see any locks > or synchronized to protect access to CACHE. Is that going to cause trouble if > two threads compete to add a locale to the map? In other words - how > confident are we that the race would be benign? Although I think the possible race is benign (it would simply overwrite the existing normalized one), I put it in a synchronization block as a safety measure, as the race would be quite rare for creating a BaseLocale instance. Tested with the microbench mark and I didn't see the number change. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14404#issuecomment-1587759179