April 2017
Beginner
504 pages
14h 11m
English
ReentrantLock is the simplest implementation of the interface lock in the JDK. There are two ways to create this type of lock: with and without fairness policy. If the ReentrantLock(Boolean fair) constructor is called with the true argument, then the lock will be assigned to the thread that is waiting for the lock the longest time in case there are many threads waiting. This will avoid a thread made to wait for infinite time and starving.
Read now
Unlock full access