Waits to be notified by another thread of a change in this
object. This method is similar to the wait method of one
argument, but it allows finer control over the amount of time
to wait for a notification before giving up. The thread
releases ownership of this monitor and waits until either of
the following two conditions has occurred:
- Another thread notifies threads waiting on this
object's monitor to wake up either through a call to
the notify method or the notifyAll method.
- The timeout period, specified by timeout milliseconds
plus nanos nanoseconds arguments, has elapsed.
The thread then waits until it can re-obtain ownership of
the monitor and resumes execution This method should
only be called by a thread that is the owner of this object's
monitor.
Parameters:
timeout - the maximum
time to wait in milliseconds.
nanos - additional
time, in nanoseconds range 0-999999.
This wait method:
- Throws IllegalArgumentException
if the value of timeout is negative or the value of nanos is
not in the range 0-999999.
- Throws IllegalMonitorStateException
if the current thread is not the owner of this object's
monitor.
- Throws InterruptedException
if another thread has interrupted this thread.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's
monitor.