Inter Thread Communication in Java using wait() and notify() - Example Tutorial

yotube
0
Wait and notify methods in Java are used for inter-thread communication i.e. if one thread wants to tell something to another thread, it uses notify() and notifyAll() method of java.lang.Object. A classical example of the wait and notify method is a Producer-Consumer design pattern, where One thread produces and put something on the shared bucket, and then tell the other thread that there is an item for your interest in a shared object, consumer thread than pick than item and do his job, without the wait() and notify(), consumer thread needs to be busy checking, even if there is no change in the state of the shared object.

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top