Edoardo Luppi
03/30/2024, 6:14 PMatomic(1)
to an AtomicIntegerFieldUpdater
instead of using an AtomicInteger
?
What's the reasoning behind it?ephemient
03/30/2024, 6:19 PMIn addition to classes representing single values, this package contains Updater classes that can be used to obtainoperations on any selected volatile field of any selected class.compareAndSet
,AtomicReferenceFieldUpdater
, andAtomicIntegerFieldUpdater
are reflection-based utilities that provide access to the associated field types. These are mainly of use in atomic data structures in which several volatile fields of the same node (for example, the links of a tree node) are independently subject to atomic updates. These classes enable greater flexibility in how and when to use atomic updates, at the expense of more awkward reflection-based setup, less convenient usage, and weaker guarantees.AtomicLongFieldUpdater
Edoardo Luppi
03/30/2024, 6:21 PMephemient
03/30/2024, 6:23 PMjw
03/30/2024, 7:52 PMEdoardo Luppi
03/30/2024, 7:53 PMephemient
03/30/2024, 7:53 PMjw
03/30/2024, 7:53 PM