In my opinion, it is another argument to discuss whether it could be
used such or not.. the problem here is different..language says wait
method should release the lock and get in a wait state until it is
notified. Java should provide for me.
also i can give an example to the usage of such self waiting and wake
up..think a thread is performing I/O and get blocked. think a method
getData() provide the data after I/O completion. an such a design can
be implement..
class IOThread(){
String data;
.
.
public synchronized getData(){
wait();
return data;
}
public synchronized void notfiyData(){
notify();//data is ready
}
public void run(){
do I/O get Data;
notfiyData();
}
Note: Another point, i am actually using the posted code like
implementation to create a suspend method in J2ME. so it is a must
for me.