Cheers,
Divyesh.
The specified amount of real time has elapsed, more or less. If timeout is zero, however, then real time is not taken into consideration and the thread simply waits until notified.
The thread T is then removed from the wait set for this object and re-enabled for thread scheduling. It then competes in the usual manner with other threads for the right to synchronize on the object; once it has gained control of the object, all its synchronization claims on the object are restored to the status quo ante - that is, to the situation as of the time that the wait method was invoked.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
BEE MBA PMP SCJP-6
Jim Hoglund wrote:I'm sorry Abimaram, but your answer is misleading.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
BEE MBA PMP SCJP-6
Bert Bates wrote:This complicated topic used to be on the SCJP exam, but it isn't any more... hooray!
Cheers,
Divyesh.
SCJP6.0,My blog Ranchers from Delhi
Cheers,
Divyesh.
SCJP6.0,My blog Ranchers from Delhi
BEE MBA PMP SCJP-6
Jim Hoglund wrote:Divyeshh : In the first post the wait() was on an object that extends Thread,
not the "main" thread. So I think the mystery notify() is a behavior of type
Thread. We should study Thread to find the answer.
Jim ... ...
Or is it that notify() is automatically called when the run method finishes?
Cheers,
Divyesh.
Divyeshh Patel wrote:
... The main thread ends only if you have called the start() method of the Thread on which the main thread is waiting,
otherwise it does not end. So probably as I had mentioned in my first post, something is happening when the run()
method finishes. [Remember, calling the run() method directly also does not end the main thread, run() has
to be called via start() only]
BEE MBA PMP SCJP-6
Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
Jim Hoglund wrote:
I'm still confused about the meaning of "main thread". Can you explain further?
Jim ... ...
Cheers,
Divyesh.
Cheers,
Divyesh.
BEE MBA PMP SCJP-6
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |