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

📄 thread.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<DD><B>Deprecated.</B>&nbsp;<I>This method has been deprecated, as it is   inherently deadlock-prone.  If the target thread holds a lock on the   monitor protecting a critical system resource when it is suspended, no   thread can access this resource until the target thread is resumed. If   the thread that would resume the target thread attempts to lock this   monitor prior to calling <code>resume</code>, deadlock results.  Such   deadlocks typically manifest themselves as "frozen" processes.   For more information, see    <a href="../../../guide/misc/threadPrimitiveDeprecation.html">Why    are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.</I><P><DD>Suspends this thread. <p> First, the <code>checkAccess</code> method of this thread is called  with no arguments. This may result in throwing a  <code>SecurityException </code>(in the current thread).  <p> If the thread is alive, it is suspended and makes no further  progress unless and until it is resumed.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify               this thread.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><HR><A NAME="resume()"><!-- --></A><H3>resume</H3><PRE>public final void <B>resume</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This method exists solely for use with <A HREF="../../java/lang/Thread.html#suspend()"><CODE>suspend()</CODE></A>,     which has been deprecated because it is deadlock-prone.     For more information, see      <a href="../../../guide/misc/threadPrimitiveDeprecation.html">Why      are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.</I><P><DD>Resumes a suspended thread. <p> First, the <code>checkAccess</code> method of this thread is called  with no arguments. This may result in throwing a  <code>SecurityException</code> (in the current thread).  <p> If the thread is alive but suspended, it is resumed and is  permitted to make progress in its execution.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify this               thread.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#checkAccess()"><CODE>checkAccess()</CODE></A>, <A HREF="../../java/lang/Thread.html#suspend()"><CODE>suspend()</CODE></A></DL></DD></DL><HR><A NAME="setPriority(int)"><!-- --></A><H3>setPriority</H3><PRE>public final void <B>setPriority</B>(int&nbsp;newPriority)</PRE><DL><DD>Changes the priority of this thread.  <p> First the <code>checkAccess</code> method of this thread is called  with no arguments. This may result in throwing a  <code>SecurityException</code>.  <p> Otherwise, the priority of this thread is set to the smaller of  the specified <code>newPriority</code> and the maximum permitted  priority of the thread's thread group.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>newPriority</CODE> - priority to set this thread to<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - If the priority is not in the               range <code>MIN_PRIORITY</code> to               <code>MAX_PRIORITY</code>.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify               this thread.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#getPriority()"><CODE>getPriority()</CODE></A>, <A HREF="../../java/lang/Thread.html#checkAccess()"><CODE>checkAccess()</CODE></A>, <A HREF="../../java/lang/Thread.html#getPriority()"><CODE>getPriority()</CODE></A>, <A HREF="../../java/lang/Thread.html#getThreadGroup()"><CODE>getThreadGroup()</CODE></A>, <A HREF="../../java/lang/Thread.html#MAX_PRIORITY"><CODE>MAX_PRIORITY</CODE></A>, <A HREF="../../java/lang/Thread.html#MIN_PRIORITY"><CODE>MIN_PRIORITY</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#getMaxPriority()"><CODE>ThreadGroup.getMaxPriority()</CODE></A></DL></DD></DL><HR><A NAME="getPriority()"><!-- --></A><H3>getPriority</H3><PRE>public final int <B>getPriority</B>()</PRE><DL><DD>Returns this thread's priority.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>this thread's name.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#setPriority(int)"><CODE>setPriority(int)</CODE></A>, <A HREF="../../java/lang/Thread.html#setPriority(int)"><CODE>setPriority(int)</CODE></A></DL></DD></DL><HR><A NAME="setName(java.lang.String)"><!-- --></A><H3>setName</H3><PRE>public final void <B>setName</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;name)</PRE><DL><DD>Changes the name of this thread to be equal to the argument  <code>name</code>.  <p> First the <code>checkAccess</code> method of this thread is called  with no arguments. This may result in throwing a  <code>SecurityException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the new name for this thread.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify this               thread.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#getName()"><CODE>getName()</CODE></A>, <A HREF="../../java/lang/Thread.html#checkAccess()"><CODE>checkAccess()</CODE></A>, <A HREF="../../java/lang/Thread.html#getName()"><CODE>getName()</CODE></A></DL></DD></DL><HR><A NAME="getName()"><!-- --></A><H3>getName</H3><PRE>public final <A HREF="../../java/lang/String.html">String</A> <B>getName</B>()</PRE><DL><DD>Returns this thread's name.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>this thread's name.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Thread.html#setName(java.lang.String)"><CODE>setName(java.lang.String)</CODE></A>, <A HREF="../../java/lang/Thread.html#setName(java.lang.String)"><CODE>setName(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getThreadGroup()"><!-- --></A><H3>getThreadGroup</H3><PRE>public final <A HREF="../../java/lang/ThreadGroup.html">ThreadGroup</A> <B>getThreadGroup</B>()</PRE><DL><DD>Returns the thread group to which this thread belongs.  This method returns null if this thread has died (been stopped).<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>this thread's thread group.</DL></DD></DL><HR><A NAME="activeCount()"><!-- --></A><H3>activeCount</H3><PRE>public static int <B>activeCount</B>()</PRE><DL><DD>Returns the current number of active threads in this thread's  thread group.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the current number of threads in this thread's thread group.</DL></DD></DL><HR><A NAME="enumerate(java.lang.Thread[])"><!-- --></A><H3>enumerate</H3><PRE>public static int <B>enumerate</B>(<A HREF="../../java/lang/Thread.html">Thread</A>[]&nbsp;tarray)</PRE><DL><DD>Copies into the specified array every active thread in  this thread's thread group and its subgroups. This method simply  calls the <code>enumerate</code> method of this thread's thread  group with the array argument.  <p> First, if there is a security manager, that <code>enumerate</code> method calls the security manager's <code>checkAccess</code> method  with the thread group as its argument. This may result  in throwing a <code>SecurityException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>tarray</CODE> - an array of Thread objects to copy to<DT><B>Returns:</B><DD>the number of threads put into the array<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its               <code>checkAccess</code> method doesn't allow the operation.<DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#enumerate(java.lang.Thread[])"><CODE>ThreadGroup.enumerate(java.lang.Thread[])</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkAccess(java.lang.ThreadGroup)"><CODE>SecurityManager.checkAccess(java.lang.ThreadGroup)</CODE></A></DL></DD></DL><HR><A NAME="countStackFrames()"><!-- --></A><H3>countStackFrames</H3><PRE>public int <B>countStackFrames</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>The definition of this call depends on <A HREF="../../java/lang/Thread.html#suspend()"><CODE>suspend()</CODE></A>,		   which is deprecated.  Further, the results of this call		   were never well-defined.</I><P><DD>Counts the number of stack frames in this thread. The thread must  be suspended.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of stack frames in this thread.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalThreadStateException.html">IllegalThreadStateException</A></CODE> - if this thread is not             suspended.</DL></DD></DL><HR><A NAME="join(long)"><!-- --></A><H3>join</H3><PRE>public final void <B>join</B>(long&nbsp;millis)                throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Waits at most <code>millis</code> milliseconds for this thread to  die. A timeout of <code>0</code> means to wait forever.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>millis</CODE> - the time to wait in milliseconds.<DT><B>Throws:</B><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="join(long, int)"><!-- --></A><H3>join</H3><PRE>public final void <B>join</B>(long&nbsp;millis,                       int&nbsp;nanos)                throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Waits at most <code>millis</code> milliseconds plus  <code>nanos</code> nanoseconds for this thread to die.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>millis</CODE> - the time to wait in milliseconds.<DD><CODE>nanos</CODE> - 0-999999 additional nanoseconds to wait.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of millis is negative               the value of nanos is not in the range 0-999999.<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="join()"><!-- --></A><H3>join</H3><PRE>public final void <B>join</B>()                throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></PRE><DL><DD>Waits for this thread to die.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><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="dumpStack()"><!-- --></A><H3>dumpStack</H3><PRE>public static void <B>dumpStack</B>()</PRE><DL><DD>Prints a stack trace of the current thread. This method is used  only for debugging.<DD><DL></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/lang/Throwable.html#printStackTrace()"><CODE>Throwable.printStackTrace()</CODE></A></DL></DD></DL><HR><A NAME="setDaemon(boolean)"><!-- --></A><H3>setDaemon</H3><PRE>public final void <B>setDaemon</B>(boolean&nbsp;on)</PRE>

⌨️ 快捷键说明

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