Runnable jcstress + JUnit companion for the ankurm.com post on the Java Memory Model, double-checked locking, and the volatile fix.
22 lines
809 B
Plaintext
22 lines
809 B
Plaintext
$ java -jar target/jcstress.jar -t PlainPublicationTest -jvmArgs "-Xmx256m" -f 2 -iters 15 -time 1000
|
|
|
|
RUN RESULTS:
|
|
Interesting tests: No matches.
|
|
|
|
Failed tests: No matches.
|
|
|
|
Error tests: No matches.
|
|
|
|
All remaining tests: 1 matching test results.
|
|
|
|
.......... [OK] com.ankurm.jmm.PlainPublicationTest
|
|
|
|
Results across all configurations:
|
|
|
|
RESULT SAMPLES FREQ EXPECT DESCRIPTION
|
|
0, 0 3,511,549,619 66.79% Acceptable Reader ran before the write was published at all.
|
|
0, 1 0 0.00% Interesting Reordering: the reference was visible before both of its ...
|
|
1, 0 0 0.00% Interesting Reordering: the reference was visible before both of its ...
|
|
1, 1 1,745,742,499 33.21% Acceptable Reader saw the fully-constructed Payload.
|
|
|