Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top