Atomic Operations
Java 1.5 added capability to define atomic variables, e.g AtomicInteger. The word ‘automic’ comes from the concept of Atomic Operations which is a process that is computed as a single unit of work without any interference.
For example, reading and writing a value to a int variable is automic, the value of variable doesnt change during this process, however the operation i++ is not since it involves first reading the value from i and then incrementing it, however the value i may change due to some other thread during the process.
Automic varibles like AutomicInteger maintains this automic feature by providing methods like getAndDecrement(), getAndSet() etc which prevents any other thread to modify the value while executing these methods.
