There are a total of 11 methods in the Object class. Three of those methods are overloaded versions of the .wait() method. Combine those three with the .notify() and the .notifyAll() methods and you have almost half of the Object class methods grouped up. What does this group of methods really do? They represent the primitive core communication methods between threads. I went back and forth on whether or not to create a tutorial on these methods because they are pretty much legacy now. The java.util.concurrent package contains many classes and methods that will handle communication between threads in a much more efficient manner. You need to have a general idea of how a Java monitor lock works so you can understand the necessary overhead that comes with using these methods.
The Monitor Lock (Intrinsic lock)
I am going to use a simple analogy of how a ship (boat) lock works in order to describe the stages of a monitor lock. The Panama Canal allows ships to cross back and forth from the Atlantic ocean to the Pacific ocean.
Ещё видео!