Search code examples
javamultithreadingdouble-checked-locking

Looking for a test to reproduce broken double checked locking


Does anybody know of a test that reproduces "broken double checked locking" problem in java?


Solution

  • Checkout this project: java-concurrency-torture. It is written by Alexey Shipilev. He is Java Performance Engineer who works at Oracle. Here is a bunch of tests for different kinds of singleton initialization practices.

    Important: To maximize your chances to see DCL bug you should run these tests with -server flag on 32-bit jvm.