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

📄 javalang.doc19.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<p><a name="27232"></a>
Every thread in this thread group or any of its subgroups is resumed. More precisely, the method <code>resume</code> is called for every <code>ThreadGroup</code> and every <code>Thread</code> <a href="javalang.doc18.html#8098">(&#167;20.20.18)</a> that belongs to this <code>ThreadGroup</code>.<p>
<a name="2888"></a>
<p><font size=+1><strong>20.21.11   </strong> <code>public final void <code><b>destroy</b></code>()<br>throws SecurityException, <code>IllegalThreadStateException</code></code></font>
<p>
<a name="27203"></a>
First, the <code>checkAccess</code> method <a href="javalang.doc19.html#27041">(&#167;20.21.4)</a> of this <code>ThreadGroup</code> object is called 
with no arguments. This may result in a <code>SecurityException</code> being thrown (in 
the current thread).
<p><a name="27256"></a>
This thread group is destroyed. If it has already been destroyed, or if any threads belong to it directly, then an <code>IllegalThreadStateException</code> is thrown. Otherwise, this method is called recursively for every thread group that belongs to this thread group, and this thread group is removed from its parent thread group.<p>
<a name="27396"></a>
A thread group that is currently marked as a daemon thread group is destroyed automatically if both of the following conditions are true:<p>
<ul><a name="27403"></a>
<li>A thread or thread group has just been removed from it (because the thread has died or the thread group has been destroyed).
<a name="27411"></a>
<li>The thread group now contains no more threads or thread groups.
</ul><a name="27398"></a>
<p><font size=+1><strong>20.21.12   </strong> <code>public final int <code><b>getMaxPriority</b></code>()</code></font>
<p>
<a name="27511"></a>
The current maximum priority of this <code>ThreadGroup</code> object is returned.
<p><a name="2890"></a>
<p><font size=+1><strong>20.21.13   </strong> <code>public final void <code><b>setMaxPriority</b></code>(int <code>newMaxPriority</code>)<br>throws <code>SecurityException</code>, IllegalArgumentException</code></font>
<p>
<a name="27210"></a>
First, the <code>checkAccess</code> method <a href="javalang.doc19.html#27041">(&#167;20.21.4)</a> of this <code>ThreadGroup</code> object is called 
with no arguments. This may result in a <code>SecurityException</code> being thrown (in 
the current thread).
<p><a name="27529"></a>
If the <code>newMaxPriority</code> argument is less than <code>MIN_PRIORITY</code> <a href="javalang.doc18.html#14148">(&#167;20.20.1)</a> or greater than <code>MAX_PRIORITY</code> <a href="javalang.doc18.html#2662">(&#167;20.20.2)</a>, then an <code>IllegalArgumentException</code> is thrown.<p>
<a name="27533"></a>
Otherwise, the priority of this <code>ThreadGroup</code> object is set to the smaller of the specified <code>newMaxPriority</code> and the maximum permitted priority <a href="javalang.doc19.html#27398">(&#167;20.21.12)</a> of the parent of this thread group <a href="javalang.doc19.html#27398">(&#167;20.21.12)</a>. (If this thread group is the system thread group, which has no parent, then its maximum priority is simply set to <code>newMaxPriority</code>.) Then this method is called recursively, with <code>newMaxPriority</code> as its argument, for every thread group that belongs to this thread group.<p>
<a name="2891"></a>
<p><font size=+1><strong>20.21.14   </strong> <code>public final boolean <code><b>isDaemon</b></code>()</code></font>
<p>
<a name="27515"></a>
The result is <code>true</code> if and only if this thread group is currently marked as a daemon 
thread group.
<p><a name="2892"></a>
<p><font size=+1><strong>20.21.15   </strong> <code>public final void <code><b>setDaemon</b></code>(boolean daemon)<br>throws <code>SecurityException</code></code></font>
<p>
<a name="27217"></a>
First, the <code>checkAccess</code> method <a href="javalang.doc19.html#27041">(&#167;20.21.4)</a> of this <code>ThreadGroup</code> object is called 
with no arguments. This may result in a <code>SecurityException</code> being thrown (in 
the current thread).
<p><a name="27588"></a>
This thread group is marked as being a daemon thread group if the argument is <code>true</code>, and as not being a daemon thread group if the argument is <code>false</code>.<p>
<a name="29427"></a>
<p><font size=+1><strong>20.21.16   </strong> <code>public 	int <code><b>threadsCount</b></code>()</code></font>
<p>
<a name="29516"></a>
This method returns the number of threads that directly belong to this thread 
group.
<p><a name="29428"></a>
<p><font size=+1><strong>20.21.17   </strong> <code>public int <code><b>allThreadsCount</b></code>()		</code></font>
<p>
<a name="29518"></a>
This method returns the number of threads that belong to this thread group or to 
any of its subgroups.
<p><a name="29429"></a>
<p><font size=+1><strong>20.21.18   </strong> <code>public int <code><b>groupsCount</b></code>()</code></font>
<p>
<a name="29525"></a>
This method returns the number of thread groups that directly belong to this 
thread group.
<p><a name="29430"></a>
<p><font size=+1><strong>20.21.19   </strong> <code>public int <code><b>allGroupsCount</b></code>()</code></font>
<p>
<a name="29529"></a>
This method returns the number of thread groups that belong to this thread group 
or to any of its subgroups.
<p><a name="29504"></a>
<p><font size=+1><strong>20.21.20   </strong> <code>public Thread[] <code><b>threads</b></code>()</code></font>
<p>
<a name="29537"></a>
This method returns a newly created array containing the <code>Thread</code> objects for all 
threads that directly belong to this thread group.
<p><a name="29554"></a>
<p><font size=+1><strong>20.21.21   </strong> <code>public 	Thread[] <code><b>allThreads</b></code>()</code></font>
<p>
<a name="29592"></a>
This method returns a newly created array containing the <code>Thread</code> objects for all 
threads that belong to this thread group or to any of its subgroups.
<p><a name="29511"></a>
<p><font size=+1><strong>20.21.22   </strong> <code>public ThreadGroup[] <code><b>groups</b></code>()</code></font>
<p>
<a name="29548"></a>
This method returns a newly created array containing the <code>ThreadGroup</code> objects 
for all thread groups that directly belong to this thread group.
<p><a name="29513"></a>
<p><font size=+1><strong>20.21.23   </strong> <code>public 	ThreadGroup[] <code><b>allGroups</b></code>()</code></font>
<p>
<a name="29600"></a>
This method returns a newly created array containing the <code>ThreadGroup</code> objects 
for all thread groups that belong to this thread group or to any of its subgroups.
<p><a name="2894"></a>
<p><font size=+1><strong>20.21.24   </strong> <code>public int <code><b>activeCount</b></code>()</code></font>
<p>
<a name="29316"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the equivalent method <code>allThreadsCount</code> instead.]
<p><a name="2895"></a>
<p><font size=+1><strong>20.21.25   </strong> <code>public int <code><b>activeGroupCount</b></code>()</code></font>
<p>
<a name="29327"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the equivalent method <code>allGroupsCount</code> instead.]
<p><a name="2896"></a>
<p><font size=+1><strong>20.21.26   </strong> <code>public int <code><b>enumerate</b></code>(Thread list[])</code></font>
<p>
<a name="29331"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the method <code>allThreads</code> instead.]
<p><a name="2897"></a>
<p><font size=+1><strong>20.21.27   </strong> <code>public int <code><b>enumerate</b></code>(Thread list[], boolean recurse)</code></font>
<p>
<a name="29340"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the method <code>threads</code> or <code>allThreads</code> instead.]
<p><a name="2898"></a>
<p><font size=+1><strong>20.21.28   </strong> <code>public int <code><b>enumerate</b></code>(ThreadGroup list[])</code></font>
<p>
<a name="29350"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the method <code>allGroups</code> instead.]
<p><a name="2899"></a>
<p><font size=+1><strong>20.21.29   </strong> <code>public int <code><b>enumerate</b></code>(ThreadGroup list[], boolean recurse)</code></font>
<p>
<a name="29344"></a>
[This method is deprecated for use in new code after Java version 1.1 becomes 
available. Use the method <code>groups</code> or <code>allGroups</code> instead.]
<p><a name="2900"></a>
<p><font size=+1><strong>20.21.30   </strong> <code>public void <code><b>list</b></code>()</code></font>
<p>
<a name="27595"></a>
This method prints a detailed description of this thread group to the output stream 
<code>System.out</code> <a href="javalang.doc17.html#14131">(&#167;20.18.2)</a>. It is intended as a convenient utility for debugging.
<p><a name="27599"></a>
The output is a series of lines; each line contains some space characters (for indentation) followed by the <code>toString</code> representation of one thread <a href="javalang.doc18.html#2680">(&#167;20.20.11)</a> or one thread group <a href="javalang.doc19.html#2881">(&#167;20.21.3)</a>.<p>
<a name="27612"></a>
The first line gives the <code>toString</code> representation for this thread group, with no indentation spaces. Following lines are then generated by a recursive rule: whenever a line is printed for a thread group <i>G</i> with <i>n</i> leading spaces, it is immediately followed by one line for each thread that directly belongs to <i>G</i>, with <img src="javalang.doc.anc43.gif"> spaces of indentation; then one line is printed for each thread group that directly belongs to <i>G</i>, with <img src="javalang.doc.anc42.gif"> spaces of indentation, using the recursive case.<p>
<a name="2901"></a>
<p><font size=+1><strong>20.21.31   </strong> <code>public void <code><b>uncaughtException</b></code>(Thread t, Throwable e)</code></font>
<p>
<a name="2877"></a>
The general contract of <code>uncaughtException</code> is that it is called whenever a thread 
that belongs directly to this thread group dies because an exception was thrown in 
that thread and not caught. The arguments are the <code>Thread</code> object for the thread in 
question and the <code>Throwable</code> object that was thrown. The <code>uncaughtException</code> 
method may then take any appropriate action.
<p><a name="27656"></a>
The call to <code>uncaughtException</code> is performed by the thread that failed to catch the exception, so <code>t</code> is the current thread. The call to <code>uncaughtException</code> is the last action of the thread before it dies. If the call to <code>uncaughtException</code> itself results in an (uncaught) exception, this fact is ignored and the thread merely goes on to die.<p>
<a name="27667"></a>
The method <code>uncaughtException</code> defined by class <code>ThreadGroup</code> takes one of two actions. If this thread group has a parent thread group, then this method is invoked for that parent thread group, with the same arguments. If this thread group is the system thread group (which has no parent), then if the exception <code>e</code> is not an instance of <code>ThreadDeath</code> <a href="javalang.doc20.html#46198">(&#167;20.22)</a>, a stack trace <a href="javalang.doc20.html#10058">(&#167;20.22.6)</a> for <code>e</code> is printed on the error output stream that is the value of the field <code>System.err</code> <a href="javalang.doc17.html#14132">(&#167;20.18.3)</a>.<p>
<a name="27858"></a>
Subclasses of <code>ThreadGroup</code> may override the <code>uncaughtException</code> method.<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc18.html">Prev</a> | <a href="javalang.doc20.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 &#169 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 + -