Use VarHandles in PingPongTransactionChain 57/100857/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:25:39 +0000 (09:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 08:56:50 +0000 (10:56 +0200)
commit4a94fedbe24344b6dbe67287a560daba8b99eb84
tree0c3ebfc9c11ce6fac5e593560ac041bb3c5256f4
parent18cb8f2e949db76fb72bfa08921ba6c73a707ec6
Use VarHandles in PingPongTransactionChain

Most of our accesses are compareAndSwap() so we do not benefit all
that much from ARFU type safety. Switch to using VarHandles to access
our atomic fields. Provide an acquireReadyTx() to deal with the few
call sites which would require explicit cast due to using getAndSet().

VarHandles allow us to use compareAndExchange(), which exposes the
witness value -- hence our error paths report the correct object without
a possibility of a race.

Change-Id: I79d2791f6e0d6accb987e46d31415452f735a7f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java