aspose file tools
The moose likes Threads and Synchronization and the fly likes wait(), notify(), notifyAll() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

wait(), notify(), notifyAll()

velmurugan
Greenhorn

Joined: Jun 08, 2006
Posts: 24
Hi everybody,

We all know that wait(), notify(), notifyAll() methods are related to Thread

What is the the need for having these 3 methods belongs Object class?

Please explain me.
Jeremy Botha
Ranch Hand

Joined: Feb 16, 2005
Posts: 125
This has been covered before.

In short, it's because most people like the ability to use objects that are not direct subclasses of Thread as lock objects for synchronization. If you take the time to think the issues through, you'll realise that an object like a Database connection pool store might not need to run in a thread, but still requires synchronization on its getConnection and releaseConnection methods.

Rather than creating a new Thread to synchronize off; doesn't it make sense to just be able to call dbConnectionPool.wait() and dbConnectionPool.notifyAll()?

J


McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: wait(), notify(), notifyAll()
 
Similar Threads
Interview q
pause a progam
Threads
SCJP 1.5 topic
Object Class