Originally posted by ramya jp:
1.Methods that will stop execution-
wait(),sleep(),join()
2.yield() causes the thread to move to Runnable state.
3.wait(),sleep(),join() causes the thread to move to Not-Runnable state.
4.wait() releases the lock.
5.sleep(),join(),yield() does not releases the lock.
6.notify() does not releases the lock immediately.
7.Threads communicates through wait(),notify(),notifyAll().
8.Calling start() twice causes Runtime Exception.
SCJP 1.4
Originally posted by ramya jp:
But in K&B pg 507,it states that in waiting/blocked/sleeping "it is not runnable but it might return to runnabe state later" so according to this
a call to wait(),sleep(),join() goes to not-runnable state....
correct me if i am wrong
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Ramaseshan T<br />SCJP 1.4
Originally posted by ramya jp:
But in K&B pg 507,it states that in waiting/blocked/sleeping "it is not runnable but it might return to runnabe state later" so according to this
a call to wait(),sleep(),join() goes to not-runnable state....
correct me if i am wrong
SCJP 1.4
Originally posted by rathi ji:
I mean , if notify doesn't realease the lock then how the thread waintin will get the lock . what is the concept of imediately ...
wait(),sleep(),join() causes the thread to move to Not-Runnable state
Waits for this thread to die.
Originally posted by rathi ji:
I meants was the same , The thread calls this line ( obj.notify(); ) will realease the lock of obj . And any other thead which is in waiting queue of obj will wake up & continue its execution ...
but why not immediately ...
Thanks .
Originally posted by Alton Hernandez:
A notify() is a request by a thread to re-acquire the lock of an object. It may or may not get that request immediately if other threads have a lock on that object.
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Originally posted by Vinicius Boson:
Alton,
The Thread that calls notify() is the one who has the lock, doesn�t it ?
Actually, It just can calls notify() in a shyncronized block.
Do you agree ?
Arthur, where are your pants? Check under this tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|