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

Pubblicato il: 09 gennaio 2016
sul canale di: 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.


In questa pagina del sito puoi guardare il video online Learn Java Programming - wait(), .notify(), and .notifyAll() Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daniel Ross 09 gennaio 2016, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 27,323 volte e gli è piaciuto 155 spettatori. Buona visione!