This question is more about terminology. I use atomic as a concurrency terminology and I describe it as such : "If multiple threads call the same method concurrently or sequentially, the result will be the same if the method is atomic" Where as I use transactional more like a unit of work terminology. A transactional job is either successful or failed and there will be no intermediate dirty state.
On the other hand, I saw this article and it claims "A method is atomic if it is "all or nothing." If a thread reads the data, the thread can only see the state before or after the execution of the atomic method — no intermediate state. After the atomic method was executed successfully, the changes are visible to all threads. The atomic method only modifies data of its own object without side effects. Here are some examples of atomic methods." It seems to me this definition is not necessarily correct. For instance the below code is atomic but has side effects I think.
public synchronized void add(){
x++;
if(System.currentTimeMillis()%10==0){
throw new RuntimeException();
}
y++;
}
Is my understanding of the terminology correct?