...
However, synchronization is a more secure alternative in situations where the volatile
keyword is inappropriate, such as if a variable's new value depends on its old value. Refer to CON01-J. Do not assume Ensure that composite operations on shared variables are atomic and CON07-J. Do not assume that a grouping of calls to independently atomic methods is atomic for more details.
...