RFR: 8303213: Avoid AtomicReference in TextComponentPrintable
Brett Okken
duke at openjdk.org
Sat Feb 25 18:19:05 UTC 2023
On Mon, 16 Jan 2023 20:25:02 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> If CompareAndSwap is not used, then AtomicReference could be replaced with volatile. It simplified code a bit.
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?
-------------
PR: https://git.openjdk.org/jdk/pull/12018
More information about the client-libs-dev
mailing list