Home » Core Java » util » concurrent » locks » ReentrantLock

ReentrantLock

Java ReentrantReadWriteLock Example

This is an example of how to make use of the ReentrantReadWriteLock class of Java. It is an implementation of ReadWriteLock, that also supports ReentrantLock functionality. The ReadWriteLock is a pair of associated Locks, one for read-only operations and one for writing. Whereas, the ReentrantLock is a reentrant mutual exclusion Lock with the same behavior as the implicit monitor lock accessed using synchronized methods ...

Read More »

Java ReentrantLock Example

In this example, we shall be demonstrating how to use ReentrantLock in Java. Rigidness of Intrinsic Locking : The traditional way of providing synchronization in multi-threaded environment was to use the synchronized keyword. However, the synchronized keyword is considered rather rigid under certain circumstances.For example, if a thread is already executing inside a synchronized block and another thread tries to enter the ...

Read More »