20.1
java.lang.Object
THE PACKAGE JAVA.LANG
Some other thread invokes the
notify
 method for this object and thread
T
happens to be arbitrarily chosen as the thread to be awakened.
Some other thread invokes the
notifyAll
 method for this object.
Some other thread interrupts ( 20.20.31) thread
T
.
The specified amount of real time has elapsed, more or less. The amount of
real time, measured in milliseconds, is given by
millis
. If
millis
 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. Thread
T
 then
returns from the invocation of the
wait
 method. Thus, on return from the
wait
method, the synchronization state of the object and of thread
T
 is exactly as it was
when the
wait
 method was invoked.
If the current thread is interrupted ( 20.20.31) by another thread while it is
waiting, then an
InterruptedException
 is thrown. This exception is not thrown
until the lock status of this object has been restored as described above.
Note that the
wait
 method, as it places the current thread into the wait set for
this object, unlocks only this object; any other objects on which the current thread
may be synchronized remain locked while the thread waits.
20.1.8
public final void wait(long millis, int nanos)
throws IllegalMonitorStateException,
InterruptedException
This method causes the current thread to wait until either some other thread
invokes the
notify
 method ( 20.1.9) or the
notifyAll
 method ( 20.1.10) for
this object, or some other thread interrupts the current thread, or a certain amount
of real time has elapsed.
The amount of real time, measured in nanoseconds, is given by:
1000000*millis+nanos
In all other respects, this method does the same thing as the method
wait
 of one
argument ( 20.1.7). In particular,
wait(0, 0)
 means the same thing as
wait(0)
.
462






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved