• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Thread topics

 
rajesh kumar rayavarapu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When to use wait(),notify(),notifyAll(),.. all of these similar methods?


pls give the response immediatly
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These methods are used for thread synchronization in multithreaded programs.
http://www.iam.ubc.ca/guides/javatut99/essential/threads/waitAndNotify.html
[ May 18, 2007: Message edited by: Jesper Young ]
 
Anita Singh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.
wait():-Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
notify():-Wakes up a single thread that is waiting on this object's monitor.
notifyAll():-Wakes up all threads that are waiting on this object's monitor.

Anita Singh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic