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.
Joined: Feb 16, 2005
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()?
McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0