Learn Java Programming - wait(), .notify(), and .notifyAll() Tutorial

Veröffentlicht am: 09 Januar 2016
auf dem Kanal: Daniel Ross
27,323
155

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.


Auf dieser Seite können Sie das Online-Video Learn Java Programming - wait(), .notify(), and .notifyAll() Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Daniel Ross 09 Januar 2016 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 27,323 Mal angesehen und es wurde von 155 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!