The most important element in a concurrent API is the synchronization mechanisms it offers to the programmer. Synchronization is the coordination of two or more tasks to get the desired result. You can synchronize the execution of two or more tasks, when they have to be executed in a predefined order, or synchronize the access to a shared resource, when only one thread at a time can execute a fragment of code or modify a block of memory. Java 8 concurrency API provides a lot of synchronization mechanisms from the basic
synchronized keyword or the
Lock interface and their implementations to protect a critical section to the more advanced
CountDownLatch classes that ...