threadgroup.html
来自「API資料大全」· HTML 代码 · 共 924 行 · 第 1/3 页
HTML
924 行
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/ThreadGroup.html#suspend()">suspend</A></B>()</CODE><BR> <B>Deprecated.</B> <I>This method is inherently deadlock-prone. See <A HREF="../../java/lang/Thread.html#suspend()"><CODE>Thread.suspend()</CODE></A> for details.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/ThreadGroup.html#toString()">toString</A></B>()</CODE><BR> Returns a string representation of this Thread group.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/lang/ThreadGroup.html#uncaughtException(java.lang.Thread, java.lang.Throwable)">uncaughtException</A></B>(<A HREF="../../java/lang/Thread.html">Thread</A> t, <A HREF="../../java/lang/Throwable.html">Throwable</A> e)</CODE><BR> Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="ThreadGroup(java.lang.String)"><!-- --></A><H3>ThreadGroup</H3><PRE>public <B>ThreadGroup</B>(<A HREF="../../java/lang/String.html">String</A> name)</PRE><DL><DD>Constructs a new thread group. The parent of this new group is the thread group of the currently running thread. <p> The <code>checkAccess</code> method of the parent thread group is called with no arguments; this may result in a security exception.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the new thread group.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot create a thread in the specified thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><HR><A NAME="ThreadGroup(java.lang.ThreadGroup, java.lang.String)"><!-- --></A><H3>ThreadGroup</H3><PRE>public <B>ThreadGroup</B>(<A HREF="../../java/lang/ThreadGroup.html">ThreadGroup</A> parent, <A HREF="../../java/lang/String.html">String</A> name)</PRE><DL><DD>Creates a new thread group. The parent of this new group is the specified thread group. <p> The <code>checkAccess</code> method of the parent thread group is called with no arguments; this may result in a security exception.<DD><DL><DT><B>Parameters:</B><DD><CODE>parent</CODE> - the parent thread group.<DD><CODE>name</CODE> - the name of the new thread group.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the thread group argument is <code>null</code>.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot create a thread in the specified thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><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 the name of this thread group.<DD><DL><DT><B>Returns:</B><DD>the name of this thread group.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="getParent()"><!-- --></A><H3>getParent</H3><PRE>public final <A HREF="../../java/lang/ThreadGroup.html">ThreadGroup</A> <B>getParent</B>()</PRE><DL><DD>Returns the parent of this thread group. <p> First, if the parent is not <code>null</code>, the <code>checkAccess</code> method of the parent thread group is called with no arguments; this may result in a security exception.<DD><DL><DT><B>Returns:</B><DD>the parent of this thread group. The top-level thread group is the only thread group whose parent is <code>null</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A>, <A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/RuntimePermission.html"><CODE>RuntimePermission</CODE></A></DL></DD></DL><HR><A NAME="getMaxPriority()"><!-- --></A><H3>getMaxPriority</H3><PRE>public final int <B>getMaxPriority</B>()</PRE><DL><DD>Returns the maximum priority of this thread group. Threads that are part of this group cannot have a higher priority than the maximum priority.<DD><DL><DT><B>Returns:</B><DD>the maximum priority that a thread in this thread group can have.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#setMaxPriority(int)"><CODE>setMaxPriority(int)</CODE></A></DL></DD></DL><HR><A NAME="isDaemon()"><!-- --></A><H3>isDaemon</H3><PRE>public final boolean <B>isDaemon</B>()</PRE><DL><DD>Tests if this thread group is a daemon thread group. A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.<DD><DL><DT><B>Returns:</B><DD><code>true</code> if this thread group is a daemon thread group; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="isDestroyed()"><!-- --></A><H3>isDestroyed</H3><PRE>public boolean <B>isDestroyed</B>()</PRE><DL><DD>Tests if this thread group has been destroyed.<DD><DL><DT><B>Returns:</B><DD>true if this object is destroyed<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="setDaemon(boolean)"><!-- --></A><H3>setDaemon</H3><PRE>public final void <B>setDaemon</B>(boolean daemon)</PRE><DL><DD>Changes the daemon status of this thread group. <p> First, the <code>checkAccess</code> method of this thread group is called with no arguments; this may result in a security exception. <p> A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.<DD><DL><DT><B>Parameters:</B><DD><CODE>daemon</CODE> - if <code>true</code>, marks this thread group as a daemon thread group; otherwise, marks this thread group as normal.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><HR><A NAME="setMaxPriority(int)"><!-- --></A><H3>setMaxPriority</H3><PRE>public final void <B>setMaxPriority</B>(int pri)</PRE><DL><DD>Sets the maximum priority of the group. <p> First, the <code>checkAccess</code> method of this thread group is called with no arguments; this may result in a security exception. <p> Threads in the thread group that already have a higher priority are not affected.<DD><DL><DT><B>Parameters:</B><DD><CODE>pri</CODE> - the new priority of the thread group.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread cannot modify this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#getMaxPriority()"><CODE>getMaxPriority()</CODE></A>, <A HREF="../../java/lang/SecurityException.html"><CODE>SecurityException</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><HR><A NAME="parentOf(java.lang.ThreadGroup)"><!-- --></A><H3>parentOf</H3><PRE>public final boolean <B>parentOf</B>(<A HREF="../../java/lang/ThreadGroup.html">ThreadGroup</A> g)</PRE><DL><DD>Tests if this thread group is either the thread group argument or one of its ancestor thread groups.<DD><DL><DT><B>Parameters:</B><DD><CODE>g</CODE> - a thread group.<DT><B>Returns:</B><DD><code>true</code> if this thread group is the thread group argument or one of its ancestor thread groups; <code>false</code> otherwise.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="checkAccess()"><!-- --></A><H3>checkAccess</H3><PRE>public final void <B>checkAccess</B>()</PRE><DL><DD>Determines if the currently running thread has permission to modify this thread group. <p> If there is a security manager, its <code>checkAccess</code> method is called with this thread group as its argument. This may result in throwing a <code>SecurityException</code>.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread is not allowed to access this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkAccess(java.lang.ThreadGroup)"><CODE>SecurityManager.checkAccess(java.lang.ThreadGroup)</CODE></A></DL></DD></DL><HR><A NAME="activeCount()"><!-- --></A><H3>activeCount</H3><PRE>public int <B>activeCount</B>()</PRE><DL><DD>Returns an estimate of the number of active threads in this thread group.<DD><DL><DT><B>Returns:</B><DD>the number of active threads in this thread group and in any other thread group that has this thread group as an ancestor.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="enumerate(java.lang.Thread[])"><!-- --></A><H3>enumerate</H3><PRE>public int <B>enumerate</B>(<A HREF="../../java/lang/Thread.html">Thread</A>[] list)</PRE><DL><DD>Copies into the specified array every active thread in this thread group and its subgroups. <p> First, the <code>checkAccess</code> method of this thread group is called with no arguments; this may result in a security exception. <p> An application should use the <code>activeCount</code> method to get an estimate of how big the array should be. If the array is too short to hold all the threads, the extra threads are silently ignored.<DD><DL><DT><B>Parameters:</B><DD><CODE>list</CODE> - an array into which to place the list of threads.<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 the current thread does not have permission to enumerate this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#activeCount()"><CODE>activeCount()</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL></DD></DL><HR><A NAME="enumerate(java.lang.Thread[], boolean)"><!-- --></A><H3>enumerate</H3><PRE>public int <B>enumerate</B>(<A HREF="../../java/lang/Thread.html">Thread</A>[] list, boolean recurse)</PRE><DL><DD>Copies into the specified array every active thread in this thread group. If the <code>recurse</code> flag is <code>true</code>, references to every active thread in this thread's subgroups are also included. If the array is too short to hold all the threads, the extra threads are silently ignored. <p> First, the <code>checkAccess</code> method of this thread group is called with no arguments; this may result in a security exception. <p> An application should use the <code>activeCount</code> method to get an estimate of how big the array should be.<DD><DL><DT><B>Parameters:</B><DD><CODE>list</CODE> - an array into which to place the list of threads.<DD><CODE>recurse</CODE> - a flag indicating whether also to include threads in thread groups that are subgroups of this thread group.<DT><B>Returns:</B><DD>the number of threads placed into the array.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if the current thread does not have permission to enumerate this thread group.<DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../java/lang/ThreadGroup.html#activeCount()"><CODE>activeCount()</CODE></A>, <A HREF="../../java/lang/ThreadGroup.html#checkAccess()"><CODE>checkAccess()</CODE></A></DL>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?