[concurrency-interest] AtomicReference.updateAndGet() mandatory updating

Doug Lea dl at cs.oswego.edu
Fri May 26 15:59:10 EDT 2017

On 05/26/2017 12:22 PM, Gil Tene wrote:

> Actually this is another case where the Java 9 spec needs to be adjusted…

The pre-jdk9 method for weak CAS is now available in four
flavors: weakCompareAndSetPlain, weakCompareAndSet,
weakCompareAndSetAcquire, weakCompareAndSetRelease.
They have different read/write access modes. The specs reflect this.
The one keeping the name weakCompareAndSet is stronger, the others
weaker than before (this is the only naming scheme that works).

About those specs... see JBS JDK-8181104
The plan is for all CAS VarHandle methods to include the sentence
  "The memory effects of a write occur regardless of outcome."
And for j.u.c.atomic methods getAndUpdate, updateAndGet,
getAndAccumulate, accumulateAndGet to include the sentence:
  "This method has memory effects of at least one volatile read and write."

Which should clear up confusion.


More information about the Concurrency-interest mailing list