This tutorial shows why we need the copy on write technique and how to use it.
Run the test with maven using:
mvn install
The tutorial is described in greater detail in this blog post
using https://vmlens.com/help/manual/ for race condition or deadlocks (mvn plugin interleave)