[concurrency-interest] AtomicLong vs AtomicLongFieldUpdater addAngGet

Doug Lea dl at cs.oswego.edu
Sat Sep 5 11:37:20 EDT 2015

On 09/05/2015 07:41 AM, Patrick Julien wrote:
> In Java 8, AtomicLong and AtomicInteger were modified to use the new
> unsafe operations, e.g.,
> public final long addAndGet(long delta) {
>      return unsafe.getAndAddLong(this, valueOffset, delta) + delta;
> }
> but not the field updater variants which still do a compare and set
> Is there any reason for this or is it just an omission?

In retrospect it is an omission. There was initially
an internal snag preventing these, but it disappeared.
We should/will correct this when reconciling with Varhandles
for jdk9.


More information about the Concurrency-interest mailing list