The Java Concurrency Stress test is a wonderful tool that is used by JDK authors to ensure that their concurrent code works correctly with regards to concurrency. Concurrent code is hard to write and even harder to test. Most of their tests are probabilistic, require a lot of skill to write, and might take many days running time and the appropriate hardware to exhibit the fail behavior. Considering all this complexity, having a framework that can help with correct test execution is a big advantage. This recipe will go through the steps that are required to write your own tests for jcstress.
To follow this recipe, the only requirement is to have an environment that is capable of compiling and running jcstress (see the Building and running jcstress recipe).