Tag Archives: atomic operations

Adding atomic operations to Java

Adding atomic operations to Java


How might atomic operations work in Java, and is there a current alternative in OpenJDK/Hotspot it could translate to.


In my previous article on Making operations on volatile fields atomic. it was pointed out a few times that “fixing” previous behaviour is unlikely to go ahead regardless of good intentions.

An alternative to this is to add an @atomic annotation.  This has the advantage of only applying to new code and not risk breaking old code.

Note: The use of a lower case name is intentional as it *doesn’t* follow current coding conventions.