O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In this recipe, you implemented a test for the LinkedTransferQueue class using the MultithreadedTC library. You can implement a test in any concurrent application or class using this library and its metronome. In the example, you implemented the classical producer/consumer problem with two consumers and a producer. You wanted to test that the first String object introduced in the buffer is consumed by the first consumer that arrives at the buffer, and the second String object introduced in the buffer is consumed by the second consumer that arrives at the buffer.

The MultithreadedTC library is based on the JUnit library, which is the most often used library to implement unit tests in Java. To implement a basic test using the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required