December 2022
Intermediate to advanced
528 pages
15h 41m
English
Concurrency libraries often contain extensive tools for inter-thread synchronization. This chapter describes some of the most common synchronizers, along with typical usage patterns.
The best-known synchronizer is the exclusive lock, which we have already seen in several code illustrations in previous chapters. What was used through synchronized is the so-called intrinsic locking mechanism of the JVM—every object can be used as a lock. The Java standard library defines three types of locks in addition to intrinsic locks. Two forms are of particular interest and are briefly discussed in this section. The third, StampedLock, is rarely used and reserved for advanced usage.
First is the class ReentrantLock ...
Read now
Unlock full access