Concurrency Anti-pattern Catalog for Java

Nonatomic operations assumed to be atomic anti-pattern

Problem: “ operation that “looks" like one operation in one programmer model (e.g., the source code level of the programming language) but actually consists of several unprotected operations at the lower abstraction levels" [FNU03].

Java example of the problem: ...

Context: Trying to perform an operation on a shared data variable atomically.

Solution: Use the volatile keyword when using 64-bit variables.

Java example of the solution: ...


[FNU03] E. Farchi, Y. Nir, and S. Ur, “Concurrent bug patterns and how to test them," in Proc. of the 1st International Workshop on Parallel and Distributed Systems: Testing and Debugging (PADTAD 2003), Apr. 2003.