ReentrantLock in Java is added on java.util.concurrent package in Java 1.5
along with other concurrent utilities like CountDownLatch, Executors, and CyclicBarrier. ReentrantLock is one of
the most useful additions in Java concurrency package and several of concurrent
collection classes from java.util.concurrent package is written using ReentrantLock, including
ConcurrentHashMap, see How ConcurrentHashMap works in Java
for more details. Two key feature of ReentrantLock, which
provides more control on lock acquisition is trying to get a lock with the ability to interrupt,
and a timeout on waiting for a lock, these are key for writing responsive and
scalable systems in Java.
This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here