Use VarHandles in PingPongTransactionChain 68/101068/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:25:39 +0000 (09:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 11 May 2022 11:51:59 +0000 (13:51 +0200)
commit1434d096f7d05030bdd7ec699fbd4c4707e3c581
treee2ce6329d89f913c80ceac4c666b32c01f0ca783
parent1e29aec00a564d5e3b79d82f2c8c86c1143d763d
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>
(cherry picked from commit 4a94fedbe24344b6dbe67287a560daba8b99eb84)
(cherry picked from commit 89dc97e6bdfa7afb5e9557c6b207b9f3bbd0c434)
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java