Hi,
When i was going through this topic, as Vicken referred i went through the topic, "notify() Vs notifyAll()" topic posted in Aug 2003, there was lot of interesting topics i found. In that Praveen Posted the below code.
-------------
1class TestThread extends Thread
2{
3public void startMe()
4{
5synchronized(this)
6{
7notify();
8System.out.println("Notified...");
9try
10{
11System.out.println("waiting in startME");
12wait();
13System.out.println("woke from wait in startME");
14
15}
16catch(InterruptedException e){}
17}
18}
19
20public void run()
21{
22try
23{
24synchronized(this)
25{
26System.out.println("waiting in run");
27wait();
28System.out.println("woke up from wait in run");
29}
30}
31catch(InterruptedException e){}
32}
33public static void main(
String[] args)throws Exception
34{
35TestThread t1 = new TestThread();
36t1.start();
37Thread.sleep(1000);
38t1.startMe();
39}
40}
----------------
Please clarify my below doubt on above programme.
There was a wait() method called on line 12. After that statement, no where in the programme, notify() or notifyAll() method is invoked, then how that thread is waking from wait state.
Thanks in Advance,
Narasimha.