O'Reilly logo
  • Dong Yu thinks this is interesting:

Race conditions can be considered harmless (or benign) if you can prove that the result of the race condition is always the same. This is a common technique in some of Java’s core classes (most commonly, the atomic classes discussed in Chapter 5); we’ll see a few examples of it in this book. But in general, a race condition is a problem that is waiting to happen. Simple changes in the algorithm can cause race conditions to manifest themselves in problematic ways. Since different virtual machines have different ordering of thread execution, the developer should ...

From

Cover of Java Threads, 3rd Edition

Note

lock blongs to a object but not something others