Java concurrency blocking and use of conditions

I can use object.wait, object.notifyand synchronized blocksto solve the problems of consumer producers. At the same time I can use locks, and conditionsout of the package java.util.concurrent. I am sure that I can’t understand why we need conditions, when we can use object.waitit notify, and that the threads wait under certain conditions, such as an empty or full queue. Is there any other benefit we get if we use java.util.concurrent.locks.Condition?

+3
source share
1 answer

This article gives a good explanation:

, Lock , . factory , , , , , Lock.

+4

All Articles