January 2018
Intermediate to advanced
350 pages
9h 7m
English
When a single thread accesses data, then the access is always thread-safe, and it is not possible for a thread to mutate data while another one is reading it. When you increase the number of threads and multiple threads can access the same data structure instances, it is possible for a thread to read the data that's currently being modified, or for two concurrent modifications to happen, leading to an inconsistent result.
Here is a schema representing this issue with two threads. Keep in mind that a Java EE server often handles around 100 to 1000 threads, so the effects are more impacting:

In this simple example, we ...
Read now
Unlock full access