The difference between synchronized and lock
Synchronize
The lock object can be any object, because the monitor method must have a lock object so that any object can be called by a method so that it is extracted into the object class to define the Monitor method
So that the lock object and the monitor object are the same, as long as the lock object is created it is both a lock object and a monitor object so that it cannot be implemented to bind multiple monitor objects on a lock object
The lock object in jdk1.5 is just a lock object
The monitor method is encapsulated in the condition object so that the lock object and the monitor object are detached more object-oriented
This enables multiple monitor objects to be bound on a lock object
Binding multiple monitor objects on a lock object solves the problem of one side waiting to wake the other in multi-producer multi-consumer multithreaded models
The difference between synchronized and lock in Java