[concurrency-interest] Difference between AtomicReference.getPlain() and getOpaque()

Florian Weimer fw at deneb.enyo.de
Sun Oct 15 04:38:51 EDT 2017


Are these methods essentially the same?  I think so, based on JLS ยง17.7:

| Writes to and reads of references are always atomic, regardless of
| whether they are implemented as 32-bit or 64-bit values.

I assume there is a difference between getPlain() and getOpaque() for
AtomicLong because of potentially non-atomic access: I assume
getOpaque() rules that out (but that is not very clear), but
getPlain() obviously does not.

Whatabout AtomicInteger and AtomicBoolean?  Do these methods show a
difference there?


More information about the Concurrency-interest mailing list