Nagy Vilmos wrote:
I wanted to mention that, the point of an AtomicBoolean is that it doesn't need synchronisation because it's, well, atomic.
The synchronization isn't necessarily for the setting/getting, but for the wait()/notifyAll(). They are using the variable both as a flag and a synchronization object, though it is a little unusual to wait with a relatively short timeout and then loop if you are going to signal the monitor as well. I personally would have used CountDownLatch or CyclicBarrier.