Java Reference
In-Depth Information
Throws SecurityException if the current thread is not allowed
to modify this group. Otherwise, this method simply returns.
public final void destroy()
Destroys this thread group. The thread group must contain no
threads or this method throws IllegalThreadStateException . If
the group contains other groups, they must also be empty of
threads. This does not destroy the threads in the group.
You can examine the contents of a thread group using two parallel sets
of methods: One gets the threads contained in the group, and the other
gets the thread groups contained in the group.
public int activeCount()
Returns an estimate of the number of active threads in this
group, including threads contained in all subgroups. This is an
estimate because by the time you get the number it may be
out of date. Threads may have died, or new ones may have
been created, during or after the invocation of activeCount . An
active thread is one for which isAlive returns true.
public int enumerate(Thread[] threadsInGroup, boolean recurse)
Fills the threadsInGroup array with a reference to every active
thread in the group, up to the size of the array, and returns
the number of threads stored. If recurse is false , only threads
directly in the group are included; If it is TRue , all threads in
the group's hierarchy will be included. ThreadGroup.enumerate
gives you control over whether you recurse, but
THReadGroup.activeCount does not. You can get a reasonable es-
timate of the size of an array needed to hold the results of
a recursive enumeration, but you will overestimate the size
needed for a non-recursive enumerate .
public int enumerate(Thread[] threadsInGroup)
 
Search WWH ::




Custom Search