Learning the code way
A small step towards sharing what I have learned.
Thursday, 24 July 2014
Conditions and Locks
In the previous post we saw how the
Lock API could be used as an alternative to synchronized block
. We also saw how the Lock API allowed us to do chain locking. There is also a
condition
object closely associated with Locks:
Saturday, 12 July 2014
Locks in Java
After semaphores I decided to look at the Lock interface in Java. The first question that comes is
"Why use locks when wait notify works well enough ?"
I looked in the documentation for the class and the below lines stand out:
‹
›
Home
View web version