RFR: 8303213: Avoid AtomicReference in TextComponentPrintable [v2]
Andrey Turbanov
aturbanov at openjdk.org
Sun Feb 26 14:55:27 UTC 2023
On Sat, 25 Feb 2023 18:16:07 GMT, Brett Okken <duke at openjdk.org> wrote:
>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8303213: Avoid AtomicReference in TextComponentPrintable
>>
>> read volatile field only once
>
> src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java line 343:
>
>> 341: public FontMetrics getFontMetrics(Font font) {
>> 342: return (frc == null)
>> 343: ? super.getFontMetrics(font)
>
> Should the be set to local variable to avoid 2 volatile reads?
I agree, it's better to read once.
-------------
PR: https://git.openjdk.org/jdk/pull/12018
More information about the client-libs-dev
mailing list