Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
You are actually telling a thread to sleep, in this case, it just happens that the thread is your "current" thread.
Originally posted by vikram hegde:
Hi Java pals,
Can any one help me in understanding the working calling wait() and calling Thread.currentThread().wait().
Case1>
...
synchronized(this){
this.wait();
}
...
Case2>
...
synchronized(this){
Thread.currentThread.wait();
}
...
Among the above specified code snippets, case1 invokes wait() on itself, which internally, puts the current executing thread on it into wait queue and releases the lock. In case2, we get the handle to the current executing thread by holding monitor on the same object and issue wait on that thread.
So, The question is are both the code achive the same or are they different? Please explain.
Thanks in advance,
Vikram Hegde
Originally posted by Maximus Smith:
Well, wait is a static method and is made to make the thread that's making the wait() execute wait. So, the reference dosen't matter.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |