All classes from the package java.util.concurrent.atomic are part of this description here. They classes separated into several groups:
- Atomic single variables
- Atomic list variables
- Atomic field updaters
- Atomic special reference variables
- Accumulators
- Adders
The idea of the atomic vriable is to garantee atomicity, means changing the state of the clases from many threads leaves the state consitent for all threads before and after operating on it.
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html
- Atomic*.lazySet - is a performance win for single writers.
- Atomic*.weakCompareAndSet - weakCompareAndSet is not a good choice for implementing locks, semaphores, initialization flags. It does not provide ordering guarantees. This provides weaker memory visibility guarantees than compareAndSet. If you have any doubt whether you should be using weakCompareAndSet or compareAndSet, then use compareAndSet.
In this group following classes belong:
- AtomicBoolean
- AtomicInteger
- AtomicLong
- AtomicReference<V>
In this group following classes belong:
- AtomicIntegerArray
- AtomicLongArray
- AtomicReferenceArray<E>
In this group following classes belong:
- AtomicIntegerFieldUpdater<T>
- AtomicLongFieldUpdater<T>
- AtomicReferenceFieldUpdater<T,V>
Examples: https://www.logicbig.com/tutorials/core-java-tutorial/java-multi-threading/atomic-field-updater.html
In this group following classes belong:
- AtomicMarkableReference<V>
- AtomicStampedReference<V>
This class is usually preferable to alternatives when multiple threads update a common value that is used for purposes such as summary statistics that are frequently updated but less frequently read. The order of accumulation within or across threads is not guaranteed and cannot be depended upon, so this class is only applicable to functions for which the order of accumulation does not matter.
In this group following classes belong:
- DoubleAccumulator
- LongAccumulator
This class is usually preferable to alternatives when multiple threads update a common value that is used for purposes such as summary statistics that are frequently updated but less frequently read. The order of accumulation within or across threads is not guaranteed and cannot be depended upon, so this class is only applicable to functions for which the order of accumulation does not matter.
In this group following classes belong:
- DoubleAdder
- LongAdder