<i18n dev> RFR: 8301552: Use AtomicReferenceArray for caching instead of CHM in ZoneOffset [v2]

Per Minborg pminborg at openjdk.org
Wed Feb 1 11:41:18 UTC 2023


On Wed, 1 Feb 2023 07:58:02 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rework using a regular array and acquire/release semantics
>
> src/java.base/share/classes/java/time/ZoneOffset.java line 147:
> 
>> 145: 
>> 146:     /** Cache of time-zone offset by offset in seconds [-18h, +18h] for each even quarter of an hour. */
>> 147:     private static final AtomicReferenceArray<ZoneOffset> SECONDS_CACHE = new AtomicReferenceArray<>(MAX_SECONDS_CACHE_SLOT * 2 + 1);
> 
> Can we use regular array instead?

We can but that entails special handling to ensure thread-safety. I will provide such a solution. Thanks.

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

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


More information about the i18n-dev mailing list