Domanda

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

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top