Skip to content

Latest commit

 

History

History
82 lines (67 loc) · 4.55 KB

atomic-variables.md

File metadata and controls

82 lines (67 loc) · 4.55 KB

Atomic Variables

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

Notes

Atomic single variables

In this group following classes belong:

Atomic list variables

In this group following classes belong:

Atomic field updaters

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

Atomic special reference variables

In this group following classes belong:

Accumulators

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:

Adders

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: