📄 18.doc.html
字号:
<p><font size=-1> of the Object's monitor lock.</font><p>
<a name="44770"></a>
<p><font size=-1> <dt> <b>See Also:</b></font><p>
<a name="44771"></a>
<p><font size=-1> <dd> <a href="#wait">wait</a>, <a href="#notifyAll">notifyAll</a></font><p>
<a name="44772"></a>
<p><font size=-1> </dl></font><p>
<a name="45022"></a>
<p><font size=-1></dl></font><p>
<a name="45023"></a>
<p><font size=-1><a name="notifyAll()"><img src="images/red-ball.gif" width=12 height=12 alt="¬<br>o "></a></font><p>
<a name="44775"></a>
<p><font size=-1><a name="notifyAll"><b>notifyAll</b></a></font><p>
<a name="44776"></a>
<p><font size=-1><pre></font><p>
<a name="44777"></a>
<p><font size=-1> public final void notifyAll()</font><p>
<a name="44778"></a>
<p><font size=-1></pre></font><p>
<a name="44779"></a>
<p><font size=-1><dl></font><p>
<a name="44780"></a>
<p><font size=-1> <dd> Notifies all the threads waiting for a condition to</font><p>
<a name="44781"></a>
<p><font size=-1>change. Threads that are waiting are generally waiting</font><p>
<a name="44782"></a>
<p><font size=-1>for another thread to change some condition. Thus, the</font><p>
<a name="44783"></a>
<p><font size=-1>thread effecting a change that more than one thread is</font><p>
<a name="44784"></a>
<p><font size=-1>waiting for notifies all the waiting threads using</font><p>
<a name="44785"></a>
<p><font size=-1>the method notifyAll(). Threads that want to wait for</font><p>
<a name="44786"></a>
<p><font size=-1>a condition to change before proceeding can call</font><p>
<a name="44787"></a>
<p><font size=-1>wait(). <p></font><p>
<a name="44788"></a>
<p><font size=-1><em>The method notifyAll() can be called only by the</font><p>
<a name="44789"></a>
<p><font size=-1>thread that is the owner of the current object's</font><p>
<a name="44790"></a>
<p><font size=-1>monitor lock.</em></font><p>
<a name="44791"></a>
<p><font size=-1> <dl></font><p>
<a name="44792"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.IllegalMonitorStateException.html#¬<br>_top_">IllegalMonitorStateException</a></font><p>
<a name="44793"></a>
<p><font size=-1> <dd> If the</font><p>
<a name="44794"></a>
<p><font size=-1> current thread is not the owner</font><p>
<a name="44795"></a>
<p><font size=-1> of the Object's monitor lock.</font><p>
<a name="44796"></a>
<p><font size=-1> <dt> <b>See Also:</b></font><p>
<a name="44797"></a>
<p><font size=-1> <dd> <a href="#wait">wait</a>, <a href="#notify">notify</a></font><p>
<a name="44798"></a>
<p><font size=-1> </dl></font><p>
<a name="45046"></a>
<p><font size=-1></dl></font><p>
<a name="45047"></a>
<p><font size=-1><a name="wait(long)"><img src="images/red-ball.gif" width=12 height=12 alt=" ¬<br>o "></a></font><p>
<a name="45042"></a>
<p><font size=-1><a name="wait"><b>wait</b></a></font><p>
<a name="44802"></a>
<p><font size=-1><pre></font><p>
<a name="45108"></a>
<p><font size=-1> public final void wait(long millis) throws <a href="java.lang.InterruptedEx¬<br>ception.html#_top_">InterruptedException</a></font><p>
<a name="45109"></a>
<p><font size=-1></pre></font><p>
<a name="44805"></a>
<p><font size=-1><dl></font><p>
<a name="44806"></a>
<p><font size=-1> <dd> Causes a thread to wait until it is notified or the</font><p>
<a name="44807"></a>
<p><font size=-1>specified timeout expires. <p></font><p>
<a name="44808"></a>
<p><font size=-1><em>The method wait(millis) can be called only by</font><p>
<a name="44809"></a>
<p><font size=-1>the thread that is the owner of the current object's</font><p>
<a name="44810"></a>
<p><font size=-1>monitor lock.</em></font><p>
<a name="44811"></a>
<p><font size=-1> <dl></font><p>
<a name="44812"></a>
<p><font size=-1> <dt> <b>Parameters:</b></font><p>
<a name="44813"></a>
<p><font size=-1> <dd> millis - the maximum time to wait,</font><p>
<a name="44814"></a>
<p><font size=-1> in milliseconds</font><p>
<a name="45118"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.IllegalMonitorStateException.html#¬<br>_top_">IllegalMonitorStateException</a></font><p>
<a name="45119"></a>
<p><font size=-1> <dd> If the</font><p>
<a name="44817"></a>
<p><font size=-1> current thread is not the owner</font><p>
<a name="44818"></a>
<p><font size=-1> of the Object's monitor lock.</font><p>
<a name="45124"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.InterruptedException.html#_top_">I¬<br>nterruptedException</a></font><p>
<a name="45125"></a>
<p><font size=-1> <dd> Another thread has</font><p>
<a name="44821"></a>
<p><font size=-1> interrupted this thread.</font><p>
<a name="44822"></a>
<p><font size=-1> </dl></font><p>
<a name="44823"></a>
<p><font size=-1></dl></font><p>
<a name="45052"></a>
<p><font size=-1><a name="wait(long, int)"><img src="images/red-ball.gif" width=12 height=12 a¬<br>lt=" o "></a></font><p>
<a name="45053"></a>
<p><font size=-1><a name="wait"><b>wait</b></a></font><p>
<a name="44826"></a>
<p><font size=-1><pre></font><p>
<a name="45142"></a>
<p><font size=-1> public final void wait(long millis,</font><p>
<a name="45143"></a>
<p><font size=-1> int nanos) throws <a href="java.lang.InterruptedExce¬<br>ption.html#_top_">InterruptedException</a></font><p>
<a name="45139"></a>
<p><font size=-1></pre></font><p>
<a name="44830"></a>
<p><font size=-1><dl></font><p>
<a name="44831"></a>
<p><font size=-1> <dd> More accurate wait.</font><p>
<a name="44832"></a>
<p><font size=-1><em>The method wait(millis, nanos) can be called only</font><p>
<a name="44833"></a>
<p><font size=-1>by the thread that is the owner of the current</font><p>
<a name="44834"></a>
<p><font size=-1>object's monitor lock.</em></font><p>
<a name="44835"></a>
<p><font size=-1> <dl></font><p>
<a name="44836"></a>
<p><font size=-1> <dt> <b>Parameters:</b></font><p>
<a name="44837"></a>
<p><font size=-1> <dd> millis - the maximum time to wait,</font><p>
<a name="44838"></a>
<p><font size=-1> in milliseconds</font><p>
<a name="44839"></a>
<p><font size=-1> <dd> nano - additional time to wait,</font><p>
<a name="44840"></a>
<p><font size=-1> in nanoseconds</font><p>
<a name="44841"></a>
<p><font size=-1> (range 0-999999)</font><p>
<a name="45148"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.IllegalMonitorStateException.html#¬<br>_top_">IllegalMonitorStateException</a></font><p>
<a name="45149"></a>
<p><font size=-1> <dd> If the</font><p>
<a name="44844"></a>
<p><font size=-1> current thread is not the owner</font><p>
<a name="44845"></a>
<p><font size=-1> of the Object's monitor lock.</font><p>
<a name="45158"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.InterruptedException.html#_top_">I¬<br>nterruptedException</a></font><p>
<a name="45159"></a>
<p><font size=-1> <dd> Another thread has</font><p>
<a name="44848"></a>
<p><font size=-1> interrupted this thread.</font><p>
<a name="44849"></a>
<p><font size=-1> </dl></font><p>
<a name="44850"></a>
<p><font size=-1></dl></font><p>
<a name="44851"></a>
<p><font size=-1><a name="wait()"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">¬<br></a></font><p>
<a name="44852"></a>
<p><font size=-1><a name="wait"><b>wait</b></a></font><p>
<a name="44853"></a>
<p><font size=-1><pre></font><p>
<a name="45164"></a>
<p><font size=-1> public final void wait() throws <a href="java.lang.InterruptedException.htm¬<br>l#_top_">InterruptedException</a></font><p>
<a name="45165"></a>
<p><font size=-1></pre></font><p>
<a name="44856"></a>
<p><font size=-1><dl></font><p>
<a name="44857"></a>
<p><font size=-1> <dd> Causes a thread to wait forever until it is notified.</font><p>
<a name="44858"></a>
<p><font size=-1><p></font><p>
<a name="44859"></a>
<p><font size=-1><em>The method wait() can be called only by the</font><p>
<a name="44860"></a>
<p><font size=-1>thread that is the owner of the current object's</font><p>
<a name="44861"></a>
<p><font size=-1>monitor lock.</em></font><p>
<a name="44862"></a>
<p><font size=-1> <dl></font><p>
<a name="45170"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.IllegalMonitorStateException.html#¬<br>_top_">IllegalMonitorStateException</a></font><p>
<a name="45171"></a>
<p><font size=-1> <dd> If the</font><p>
<a name="44865"></a>
<p><font size=-1> current thread is not the owner</font><p>
<a name="44866"></a>
<p><font size=-1> of the Object's monitor lock.</font><p>
<a name="45184"></a>
<p><font size=-1> <dt> <b>Throws:</b> <a href="java.lang.InterruptedException.html#_top_">I¬<br>nterruptedException</a></font><p>
<a name="45185"></a>
<p><font size=-1> <dd> Another thread has</font><p>
<a name="44869"></a>
<p><font size=-1> interrupted this thread.</font><p>
<a name="44870"></a>
<p><font size=-1> </dl></font><p>
<a name="44871"></a>
<p><font size=-1></dl></font><p>
<a name="44872"></a>
<p><font size=-1><a name="finalize()"><img src="images/red-ball.gif" width=12 height=12 alt=" ¬<br>o "></a></font><p>
<a name="44873"></a>
<p><font size=-1><a name="finalize"><b>finalize</b></a></font><p>
<a name="44874"></a>
<p><font size=-1><pre></font><p>
<a name="45190"></a>
<p><font size=-1> protected void finalize() throws <a href="java.lang.Throwable.html#_top_">T¬<br>hrowable</a></font><p>
<a name="45191"></a>
<p><font size=-1></pre></font><p>
<a name="44877"></a>
<p><font size=-1><dl></font><p>
<a name="44878"></a>
<p><font size=-1> <dd> Code to perform when this object is garbage collected.</font><p>
<a name="44879"></a>
<p><font size=-1>The default is that nothing needs to be performed.</font><p>
<a name="44880"></a>
<p><font size=-1>Any exception thrown by a finalize method causes the</font><p>
<a name="44881"></a>
<p><font size=-1>finalization to halt. But otherwise, it is ignored.</font><p>
<a name="44882"></a>
<p><font size=-1></dl></font><p>
<a name="44883"></a>
<p><font size=-1><hr></font><p>
<a name="44884"></a>
<p><font size=-1><pre></font><p>
<a name="45209"></a>
<p><font size=-1><a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy¬<br></a> <a href="Package-java.lang.html">This Package</a> <a href="java.lang.N¬<br>umber.html#_top_">Previous</a> <a href="java.lang.OutOfMemoryError.html#_top¬<br>_">Next</a> <a href="AllNames.html">Index</a></pre></font><p>
<a name="44886"></a>
<p><font size=-1></body></font><p>
<a name="44887"></a>
<p><font size=-1></html></font><p>
<a name="44145"></a>
Many of the lines in this HTML file are far too long to fit onto these pages. We
have used the character "<code>¬</code>" at the end of a line to indicate that the following line
of text on the page is part of the same line in the generated file.
<p><a name="45218"></a>
This generated HTML file is meant only as an example, not as a specification of the behavior of the <code>javadoc</code> tool, which may be changed over time to improve the HTML presentation of the documentation information.<p>
<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="17.doc.html">Prev</a> | <a href="19.doc.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright © 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -