Atomic Types
suggest changeIntroduction
Java Atomic Types are simple mutable types that provide basic operations that are thread-safe and atomic without resorting to locking. They are intended for use in cases where locking would be a concurrency bottleneck, or where there is risk of deadlock or livelock.
Parameters
Parameter | Description |
— | — |
set | Volatile set of the field |
get | Volatile read of the field |
lazySet | This is a store ordered operation of the field |
compareAndSet | If the value is the expected value, set it to the new value |
getAndSet | get the current value and update |
Remarks
Many of these operations are combinations of volatile reads or writes and CAS operations. The clearest way to see that is to read the source. E.g. AtomicInteger, Unsafe.getAndSet
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents