Grokking Java Interview Questions
Vote

0% completed

​

ReentrantLock and ReadWriteLock

Two threads each need a lock that another thread holds. The first one is at the start of a synchronized block, so it waits until the lock is free, however long that takes, and an interrupt does not end its wait. The second one calls tryLock(50, TimeUnit.MILLISECONDS) on a lock object. After 50 milliseconds it receives false and can do something else.

The second form is an explicit lock: an ordinary object with methods that acquire and release it

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content