java.util.concurrent
API provides a class called as Lock
, which would basically serialize the control in order to access the critical resource. It gives method such as park()
and unpark()
.
We can do similar things if we can use synchronized
keyword and using wait()
and notify() notifyAll()
methods.
I am wondering which one of these is better in practice and why?