Atomic Variables
in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
addAndGet()
, decrementAndGet()
,
incrementAndGet()
getAndAdd()
, getAndDecrement()
,
getAndIncrement()
compareAndSet()
, weakCompareAndSet()
get()
, lazySet()
, set()
NonatomicInteger
class
to demonstrate the problems that can arise when
using shared mutable stateSynchronizedInteger
class to
demonstrate how these problems could be overcome with
synchronizationAtomicInteger
insteadDoubleAdder
(for a variety of reasons)static long Double.doubleToLongBits(double value)
static double Double.longBitsToDouble(long bits)