⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 object.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 3 页
字号:
 specified amount of time has elapsed.  <p> The current thread must own this object's monitor.  <p> This method causes the current thread (call it <var>T</var>) to  place itself in the wait set for this object and then to relinquish  any and all synchronization claims on this object. Thread <var>T</var>  becomes disabled for thread scheduling purposes and lies dormant  until one of four things happens: <ul> <li>Some other thread invokes the <tt>notify</tt> method for this  object and thread <var>T</var> happens to be arbitrarily chosen as  the thread to be awakened.  <li>Some other thread invokes the <tt>notifyAll</tt> method for this  object.  <li>Some other thread <A HREF="../../java/lang/Thread.html#interrupt()"><CODE>interrupts</CODE></A>  thread <var>T</var>.  <li>The specified amount of real time has elapsed, more or less.  If  <tt>timeout</tt> is zero, however, then real time is not taken into  consideration and the thread simply waits until notified.  </ul> The thread <var>T</var> 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 <tt>wait</tt>  method was invoked. Thread <var>T</var> then returns from the  invocation of the <tt>wait</tt> method. Thus, on return from the  <tt>wait</tt> method, the synchronization state of the object and of  thread <tt>T</tt> is exactly as it was when the <tt>wait</tt> method  was invoked.  <p> If the current thread is  <A HREF="../../java/lang/Thread.html#interrupt()"><CODE>interrupted</CODE></A> by another thread  while it is waiting, then an <tt>InterruptedException</tt> is thrown.  This exception is not thrown until the lock status of this object has  been restored as described above. <p> Note that the <tt>wait</tt> 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. <p> This method should only be called by a thread that is the owner  of this object's monitor. See the <code>notify</code> method for a  description of the ways in which a thread can become the owner of  a monitor.<DD><DL><DT><B>Parameters:</B><DD><CODE>timeout</CODE> - the maximum time to wait in milliseconds.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of timeout is		     negative.<DD><CODE><A HREF="../../java/lang/IllegalMonitorStateException.html">IllegalMonitorStateException</A></CODE> - if the current thread is not               the owner of the object's monitor.<DD><CODE><A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - if another thread has interrupted             the current thread.  The <i>interrupted status</i> of the             current thread is cleared when this exception is thrown.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Object.html#notify()"><CODE>notify()</CODE></A>, <A HREF="../../java/lang/Object.html#notifyAll()"><CODE>notifyAll()</CODE></A></DL></DD></DL><HR><A NAME="wait(long, int)"><!-- --></A><H3>wait</H3><PRE>public final void <B>wait</B>(long&nbsp;timeout,                       int&nbsp;nanos)                throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Causes current thread to wait until another thread invokes the  <A HREF="../../java/lang/Object.html#notify()"><CODE>notify()</CODE></A> method or the  <A HREF="../../java/lang/Object.html#notifyAll()"><CODE>notifyAll()</CODE></A> method for this object, or  some other thread interrupts the current thread, or a certain  amount of real time has elapsed.  <p> This method is similar to the <code>wait</code> method of one  argument, but it allows finer control over the amount of time to  wait for a notification before giving up. The amount of real time,  measured in nanoseconds, is given by: <blockquote> <pre> 1000000*millis+nanos</pre></blockquote> <p> In all other respects, this method does the same thing as the  method <A HREF="../../java/lang/Object.html#wait(long)"><CODE>wait(long)</CODE></A> of one argument. In particular,  <tt>wait(0, 0)</tt> means the same thing as <tt>wait(0)</tt>. <p> The current thread must own this object's monitor. The thread  releases ownership of this monitor and waits until either of the  following two conditions has occurred:  <ul> <li>Another thread notifies threads waiting on this object's monitor      to wake up either through a call to the <code>notify</code> method      or the <code>notifyAll</code> method.  <li>The timeout period, specified by <code>timeout</code>      milliseconds plus <code>nanos</code> nanoseconds arguments, has      elapsed.  </ul> <p> The thread then waits until it can re-obtain ownership of the  monitor and resumes execution  <p> This method should only be called by a thread that is the owner  of this object's monitor. See the <code>notify</code> method for a  description of the ways in which a thread can become the owner of  a monitor.<DD><DL><DT><B>Parameters:</B><DD><CODE>timeout</CODE> - the maximum time to wait in milliseconds.<DD><CODE>nanos</CODE> - additional time, in nanoseconds range                       0-999999.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of timeout is			    negative or the value of nanos is			    not in the range 0-999999.<DD><CODE><A HREF="../../java/lang/IllegalMonitorStateException.html">IllegalMonitorStateException</A></CODE> - if the current thread is not               the owner of this object's monitor.<DD><CODE><A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - if another thread has interrupted             the current thread.  The <i>interrupted status</i> of the             current thread is cleared when this exception is thrown.</DL></DD></DL><HR><A NAME="wait()"><!-- --></A><H3>wait</H3><PRE>public final void <B>wait</B>()                throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Causes current thread to wait until another thread invokes the  <A HREF="../../java/lang/Object.html#notify()"><CODE>notify()</CODE></A> method or the  <A HREF="../../java/lang/Object.html#notifyAll()"><CODE>notifyAll()</CODE></A> method for this object.  In other word's this method behaves exactly as if it simply  performs the call <tt>wait(0)</tt>. <p> The current thread must own this object's monitor. The thread  releases ownership of this monitor and waits until another thread  notifies threads waiting on this object's monitor to wake up  either through a call to the <code>notify</code> method or the  <code>notifyAll</code> method. The thread then waits until it can  re-obtain ownership of the monitor and resumes execution.  <p> This method should only be called by a thread that is the owner  of this object's monitor. See the <code>notify</code> method for a  description of the ways in which a thread can become the owner of  a monitor.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalMonitorStateException.html">IllegalMonitorStateException</A></CODE> - if the current thread is not               the owner of the object's monitor.<DD><CODE><A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - if another thread has interrupted             the current thread.  The <i>interrupted status</i> of the             current thread is cleared when this exception is thrown.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Object.html#notify()"><CODE>notify()</CODE></A>, <A HREF="../../java/lang/Object.html#notifyAll()"><CODE>notifyAll()</CODE></A></DL></DD></DL><HR><A NAME="finalize()"><!-- --></A><H3>finalize</H3><PRE>protected void <B>finalize</B>()                 throws <A HREF="../../java/lang/Throwable.html">Throwable</A></PRE><DL><DD>Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the <code>finalize</code> method to dispose of system resources or to perform other cleanup.  <p> The general contract of <tt>finalize</tt> is that it is invoked  if and when the Java<font size="-2"><sup>TM</sup></font> virtual  machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The <tt>finalize</tt> method may take any action, including making this object available again to other threads; the usual purpose of <tt>finalize</tt>, however, is to perform cleanup actions before  the object is irrevocably discarded. For example, the finalize method  for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.  <p> The <tt>finalize</tt> method of class <tt>Object</tt> performs no  special action; it simply returns normally. Subclasses of  <tt>Object</tt> may override this definition. <p> The Java programming language does not guarantee which thread will  invoke the <tt>finalize</tt> method for any given object. It is  guaranteed, however, that the thread that invokes finalize will not  be holding any user-visible synchronization locks when finalize is  invoked. If an uncaught exception is thrown by the finalize method,  the exception is ignored and finalization of that object terminates. <p> After the <tt>finalize</tt> method has been invoked for an object, no  further action is taken until the Java virtual machine has again  determined that there is no longer any means by which this object can  be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized,  at which point the object may be discarded. <p> The <tt>finalize</tt> method is never invoked more than once by a Java virtual machine for any given object. <p> Any exception thrown by the <code>finalize</code> method causes  the finalization of this object to be halted, but is otherwise  ignored.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/Throwable.html">Throwable</A></CODE> - the <code>Exception</code> raised by this method</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Object.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/lang/Number.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/lang/Package.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Object.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation  contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -