|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ThreadGroup
A group of Threads. A Thread group can contain a set of Threads as well as a set of other Thread groups. A Thread can access its Thread group, but it can't access the parent of its Thread group. This makes it possible to encapsulate a Thread in a Thread group and stop it from manipulating Threads in the parent group.
Constructor Summary | |
ThreadGroup(String name)
Creates a new ThreadGroup. |
|
ThreadGroup(ThreadGroup parent,
String name)
Creates a new ThreadGroup with a specified name in the specified Thread group. |
Method Summary | |
int |
activeCount()
Returns an estimate of the number of active Threads in the Thread group. |
int |
activeGroupCount()
Returns an estimate of the number of active groups in the Thread group. |
void |
checkAccess()
Checks to see if the current Thread is allowed to modify this group. |
void |
destroy()
Destroys a Thread group. |
int |
enumerate(Thread[] list)
Copies, into the specified array, references to every active Thread in this Thread group. |
int |
enumerate(Thread[] list,
boolean recurse)
Copies, into the specified array, references to every active Thread in this Thread group. |
int |
enumerate(ThreadGroup[] list)
Copies, into the specified array, references to every active Thread group in this Thread group. |
int |
enumerate(ThreadGroup[] list,
boolean recurse)
Copies, into the specified array, references to every active Thread group in this Thread group. |
int |
getMaxPriority()
Gets the maximum priority of the group. |
String |
getName()
Gets the name of this Thread group. |
ThreadGroup |
getParent()
Gets the parent of this Thread group. |
boolean |
isDaemon()
Returns the daemon flag of the Thread group. |
void |
list()
Lists this Thread group. |
boolean |
parentOf(ThreadGroup g)
Checks to see if this Thread group is a parent of or is equal to another Thread group. |
void |
resume()
Resumes all the Threads in this Thread group and all of its sub groups. |
void |
setDaemon(boolean daemon)
Changes the daemon status of this group. |
void |
setMaxPriority(int pri)
Sets the maximum priority of the group. |
void |
stop()
Stops all the Threads in this Thread group and all of its sub groups. |
void |
suspend()
Suspends all the Threads in this Thread group and all of its sub groups. |
String |
toString()
Returns a String representation of the Thread group. |
void |
uncaughtException(Thread t,
Throwable e)
Called when a thread in this group exists because of an uncaught exception. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ThreadGroup(String name)
name
- the name of the new Thread group createdpublic ThreadGroup(ThreadGroup parent, String name)
parent
- the specified parent Thread groupname
- the name of the new Thread group being created
NullPointerException
- If the given thread group is equal to null.Method Detail |
public final String getName()
public final ThreadGroup getParent()
public final int getMaxPriority()
public final boolean isDaemon()
public final void setDaemon(boolean daemon)
daemon
- the daemon boolean which is to be set.public final void setMaxPriority(int pri)
pri
- the priority of the Thread grouppublic final boolean parentOf(ThreadGroup g)
g
- the Thread group to be checked
public final void checkAccess()
SecurityException
- If the current Thread is not allowed
to access this Thread group.public int activeCount()
public int enumerate(Thread[] list)
list
- an array of Threads
public int enumerate(Thread[] list, boolean recurse)
list
- an array list of Threadsrecurse
- a boolean indicating whether a Thread has reapearred
public int activeGroupCount()
public int enumerate(ThreadGroup[] list)
list
- an array of Thread groups
public int enumerate(ThreadGroup[] list, boolean recurse)
list
- an array list of Thread groupsrecurse
- a boolean indicating if a Thread group has reappeared
public final void stop()
public final void suspend()
public final void resume()
public final void destroy()
IllegalThreadStateException
- If the Thread group is not empty
or if the Thread group was already destroyed.public void list()
public void uncaughtException(Thread t, Throwable e)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |