RFR: 8196869: Optimize Locale creation

Claes Redestad claes.redestad at oracle.com
Wed Feb 7 15:12:25 UTC 2018


On 2018-02-07 16:01, Peter Levart wrote:
> Hi Claes,
>
> On 02/07/2018 03:23 PM, Claes Redestad wrote:
>> Updated webrev:
>>
>> http://cr.openjdk.java.net/~redestad/8196869/jdk.02/
>>
>> - use map.remove(entry.getKey(), entry) instead of 
>> map.remove(entry.getKey())
>> - for most Locales, Locale$LocaleKey.exts is null, so using the 
>> BaseLocale as key
>>   directly in Locale allows us to avoid loading Locale$LocaleKey 
>> except in exceptional
>>   circumstances.
>> - use map.replace to safely update the entry when putIfAbsent returns 
>> an object
>>   but it points to a cleared value, so that (benign) races to create 
>> new Locale objects
>>   will canonicalize 
>
> I don't know it it's only me, but I see an old version of 
> LocaleObjectCache in webrev at above URL.

Sorry about that - the intended webrev have now replace the old on in-place.

/Claes


More information about the core-libs-dev mailing list