Use VarHandles in PingPongTransactionChain 28/101028/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:25:39 +0000 (09:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 10 May 2022 05:49:53 +0000 (07:49 +0200)
commit89dc97e6bdfa7afb5e9557c6b207b9f3bbd0c434
treead4ba975d3ea685b3df40a2ea5f67e2643d32044
parent221e59a1ffa68caff0ca09e124b20d084f4e8be9
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)
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java