DZone

Brian Goetz lists AtomicReference in his the book Java Concurrency in Practice in the in the section on advanced topics. Yet we will see that AtomicReferences are, for specific use cases, easier to use than synchronized blocks. And the relatively new JDK 8 getAndUpdate and updateAndGet methods make AtomicReference even easier to use.

Let us start with the first topic, a use case that can be more easily implemented by an AtomicReference than by a synchronized block: a concurrent state machine.

Source: DZone