This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
1. Some other thread invokes the notify method for this object and thread T happens to be arbitrarily chosen as the thread to be awakened.
其他线程调用了notify
2. Some other thread invokes the notifyAll method for this object.
其他线程调用了notifyall
3. Some other thread interrupts thread T.
其他线程中断了次线程
4. 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.
执行的实时时间到了,如果超时时间设置为0,那么将会忽略配置的超时时间,一直等到其他线程唤醒。
The thread T is then removed from the wait set for this object and re-enabled for thread
然后线程T就从等待集合中被移除,和其他线程一起抢占资源,然后执行
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.
关注我,不迷路。