| java.lang.Object | |
| ↳ | java.lang.ThreadGroup |
An implementation of this class is provided, but the documented constructors are used by the vm specific implementation to create the required "system" and "main" ThreadGroups. The documented methods are used by java.lang.Thread to add and remove Threads from their ThreadGroups. ThreadGroups are containers of Threads and ThreadGroups, therefore providing a tree-like structure to organize Threads. The root ThreadGroup name is "system" and it has no parent ThreadGroup. All other ThreadGroups have exactly one parent ThreadGroup. All Threads belong to exactly one ThreadGroup.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new ThreadGroup with the name provided.
| |||||||||||
Constructs a new ThreadGroup with the name provided, as child of the
ThreadGroup
parent | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the number of Threads which are children of the receiver,
directly or indirectly.
| |||||||||||
Returns the number of ThreadGroups which are children of the receiver,
directly or indirectly.
| |||||||||||
This method is deprecated.
Required deprecated method suspend().
| |||||||||||
If there is a SecurityManager installed, call
checkAccess
in it passing the receiver as parameter, otherwise do nothing. | |||||||||||
Destroys the receiver and recursively all its subgroups.
| |||||||||||
Copies an array with all ThreadGroups which are children of the receiver
(directly or indirectly) into the array
groups passed as
parameters. | |||||||||||
Copies an array with all ThreadGroups which are children of the receiver
into the array
groups passed as parameter. | |||||||||||
Copies an array with all Threads which are children of the receiver into
the array
threads passed as parameter. | |||||||||||
Copies an array with all Threads which are children of the receiver
(directly or indirectly) into the array
threads passed as
parameters. | |||||||||||
Returns the maximum allowed priority for a Thread in the receiver.
| |||||||||||
Returns the name of the receiver.
| |||||||||||
Returns the receiver's parent ThreadGroup.
| |||||||||||
Interrupts every Thread in the receiver and recursively in all its
subgroups.
| |||||||||||
Returns true if the receiver is a daemon ThreadGroup, false otherwise.
| |||||||||||
Returns true if the receiver has been destroyed already, false otherwise.
| |||||||||||
Outputs to
System.out a text representation of the
hierarchy of Threads and ThreadGroups in the receiver (and recursively). | |||||||||||
Returns true if the receiver is a direct or indirect parent group of
ThreadGroup
g, false otherwise. | |||||||||||
This method is deprecated.
Requires deprecated method Thread.resume().
| |||||||||||
Configures the receiver to be a daemon ThreadGroup or not.
| |||||||||||
Configures the maximum allowed priority for a Thread in the receiver and
recursively in all its subgroups.
| |||||||||||
This method is deprecated.
Requires deprecated method Thread.stop().
| |||||||||||
This method is deprecated.
Requires deprecated method Thread.suspend().
| |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
Any uncaught exception in any Thread has to be forwarded (by the VM) to
the Thread's ThreadGroup by sending this message (uncaughtException).
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface java.lang.Thread.UncaughtExceptionHandler
| |||||||||||
Constructs a new ThreadGroup with the name provided. The new ThreadGroup
will be child of the ThreadGroup to which the
Thread.currentThread() belongs.
| name | Name for the ThreadGroup being created |
|---|
| SecurityException | if checkAccess() for the parent
group fails with a SecurityException |
|---|
Constructs a new ThreadGroup with the name provided, as child of the
ThreadGroup parent
| parent | Parent ThreadGroup |
|---|---|
| name | Name for the ThreadGroup being created |
| NullPointerException | if parent is
null |
|---|---|
| SecurityException | if checkAccess() for the parent
group fails with a SecurityException |
| IllegalThreadStateException | if parent has been
destroyed already
|
Returns the number of Threads which are children of the receiver, directly or indirectly.
Returns the number of ThreadGroups which are children of the receiver, directly or indirectly.
This method is deprecated.Required deprecated method suspend().
The definition of this method depends on the deprecated method
suspend(). The behavior of this call was never specified.
| b | Used to control low memory implicit suspension |
|---|
If there is a SecurityManager installed, call checkAccess
in it passing the receiver as parameter, otherwise do nothing.
Destroys the receiver and recursively all its subgroups. It is only legal to destroy a ThreadGroup that has no Threads. Any daemon ThreadGroup is destroyed automatically when it becomes empty (no Threads and no ThreadGroups in it).
| IllegalThreadStateException | if the receiver or any of its subgroups has been destroyed already |
|---|---|
| SecurityException | if this.checkAccess() fails with
a SecurityException
|
Copies an array with all ThreadGroups which are children of the receiver
(directly or indirectly) into the array groups passed as
parameters. If the array passed as parameter is too small no exception is
thrown - the extra elements are simply not copied.
| groups | array into which the ThreadGroups will be copied |
|---|
Copies an array with all ThreadGroups which are children of the receiver
into the array groups passed as parameter. Children
ThreadGroups of subgroups are recursively copied as well if parameter
recurse is true.
If the array passed as parameter is too small no exception is thrown -
the extra elements are simply not copied.
| groups | array into which the ThreadGroups will be copied |
|---|---|
| recurse | Indicates whether ThreadGroups in subgroups should be recursively copied as well or not |
Copies an array with all Threads which are children of the receiver into
the array threads passed as parameter. Children Threads of
subgroups are recursively copied as well if parameter
recurse is true.
If the array passed as parameter is too small no exception is thrown -
the extra elements are simply not copied.
| threads | array into which the Threads will be copied |
|---|---|
| recurse | Indicates whether Threads in subgroups should be recursively copied as well or not |
Copies an array with all Threads which are children of the receiver
(directly or indirectly) into the array threads passed as
parameters. If the array passed as parameter is too small no exception is
thrown - the extra elements are simply not copied.
| threads | Thread array into which the Threads will be copied |
|---|
Returns the maximum allowed priority for a Thread in the receiver.
int)Returns the name of the receiver.
Returns the receiver's parent ThreadGroup. It can be null if the receiver is the the root ThreadGroup.
Interrupts every Thread in the receiver and recursively in all its subgroups.
| SecurityException | if this.checkAccess() fails with
a SecurityException |
|---|
Returns true if the receiver is a daemon ThreadGroup, false otherwise.
Returns true if the receiver has been destroyed already, false otherwise.
Outputs to System.out a text representation of the
hierarchy of Threads and ThreadGroups in the receiver (and recursively).
Proper indentation is done to suggest the nesting of groups inside groups
and threads inside groups.
Returns true if the receiver is a direct or indirect parent group of
ThreadGroup g, false otherwise.
| g | ThreadGroup to test |
|---|
This method is deprecated.Requires deprecated method Thread.resume().
Resumes every Thread in the receiver and recursively in all its subgroups.
| SecurityException | if this.checkAccess() fails with
a SecurityException |
|---|
Configures the receiver to be a daemon ThreadGroup or not. Daemon ThreadGroups are automatically destroyed when they become empty.
| isDaemon | new value defining if receiver should be daemon or not |
|---|
| SecurityException | if checkAccess() for the parent
group fails with a SecurityException |
|---|
Configures the maximum allowed priority for a Thread in the receiver and recursively in all its subgroups. One can never change the maximum priority of a ThreadGroup to be higher than it was. Such an attempt will not result in an exception, it will simply leave the ThreadGroup with its current maximum priority.
| newMax | the new maximum priority to be set |
|---|
| SecurityException | if checkAccess() fails with a
SecurityException |
|---|---|
| IllegalArgumentException | if the new priority is greater than Thread.MAX_PRIORITY or less than Thread.MIN_PRIORITY |
This method is deprecated.Requires deprecated method Thread.stop().
Stops every Thread in the receiver and recursively in all its subgroups.
| SecurityException | if this.checkAccess() fails with
a SecurityException |
|---|
This method is deprecated.Requires deprecated method Thread.suspend().
Suspends every Thread in the receiver and recursively in all its subgroups.
| SecurityException | if this.checkAccess() fails with
a SecurityException |
|---|
Returns a string containing a concise, human-readable description of the receiver.
Any uncaught exception in any Thread has to be forwarded (by the VM) to the Thread's ThreadGroup by sending this message (uncaughtException). This allows users to define custom ThreadGroup classes and custom behavior for when a Thread has an uncaughtException or when it does (ThreadDeath).
| t | Thread with an uncaught exception |
|---|---|
| e | The uncaught exception itself |