ReentrantLock

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.236.27