ReentrantLock in Java

A Reentrant lock is an implementation of java.util.concurrent.Lock interface with the same basic behavior and semantics as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities. Lock is acquired by lock() method and held by Thread until a call to unlock() method. ReentrantLock provides same visibility and ordering guarantee, provided […]

Read More

Lock in Java

We are already aware of basic concepts around thread synchronization and various mechanisms using synchronized keyword. A lock interface is a thread synchronization aid like synchronized block except lock can be used in a more sophisticated way than Java’s synchronized blocks. A lock is a tool for controlling access to a shared resource by multiple […]

Read More