Summary
Testing concurrent applications is a very hard task. There's no guarantee of the order of execution of the threads (unless the synchronization mechanisms have been introduced in your application) so you should test many more different situations than in a serial application. Sometimes, you will have errors in your application that you can reproduce because they only occur in very rare situations, and sometimes you will have errors that only occur in specific machines because of their hardware or software configurations.
In this chapter, you have learned some mechanisms that can help you to test concurrency applications more easily. First, you have learned how to obtain information about the status of the most important components of the Java concurrency API as Thread
, Lock
, Executor
or Stream
. This information can be very useful if you need to detect the cause of an error. Then, you learned how to use Java VisualVM to monitor Java applications in general and concurrent applications...