• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding thread interaction

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone please explain
1) what is the purpose of wait(),notify() and notifyAll()
2) wait(),notify(),notifyAll() methods in detail with example..its really confusing
thanks in advance
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please SearchFirst. This question has been asked and answer a number of times.

Also, what is your exact confusion?
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't worry about this for the exam because wait, notify and notifyAll is removed from the exam.

When two or more threads are accessing the same object, just like a bank account, wait and notify are used. One thread withdraws money from that account, two other threads should wait until the account is released by that thread before they can withdraw or add money to the account. When the thread finishes its withdrawal, it notifies one thread or notifies more than one thread by notifyAll() not to wait.

For more detail about this thread issues, I would recommend you to read any editon of How to Program in Java by Deital and Deital. This book should be available in any public library.
reply
    Bookmark Topic Watch Topic
  • New Topic