Not only is this not necessary, it is actually semantically incorrect. AtomicReferencecontains a “real” link within itself and controls access to it using its own synchronization constructs. Native JVM synchronization constructs ( synchronized, volatileetc.) And are not used. The object AtomicReferenceitself should not be considered volatile. If anything, think about it final.
Also consider this question - volatileit can be considered an alternative to use AtomicReferenceif you only need get and set operations.
source
share