Thread Group Methods
Home ] Up ] The Default Thread Group ] Creating a Thread Group ] [ Thread Group Methods ] Thread Group Tree Navigation ] An Example ]

 

 

Here's a synopsis of the ThreadGroup methods. (Entries in red are deprecated in JDK 1.2, and should not be used in any JDK version.)

public int activeCount() Returns an estimate of the number of active threads in this thread group.
public int activeGroupCount() Returns an estimate of the number of active groups in this thread group.
public boolean allowThreadSuspension(boolean b) Used by VM to control lowmem implicit suspension.
public final void checkAccess() Determines if the currently running thread has permission to modify this thread group.
public final destroy() Destroys this thread group and all of its subgroups.
public int enumerate(Thread[] list) Copies into the specified array every active thread in this thread group and its subgroups.
public int enumerate(ThreadGroup[] list, boolean recurse) Copies into the specified array references to every active subgroup in this thread group.
public int enumerate(ThreadGroup[] list) Copies into the specified array references to every active subgroup in this thread group.
public int enumerate(Thread[] list, boolean recurse) Copies into the specified array every active thread in this thread group.
public final int getMaxPriority() Returns the maximum priority of this thread group.
public final getName() Returns the name of this thread group.
public final ThreadGroup getParent() Returns the parent of this thread group
public final boolean isDaemon() Tests if this thread group is a daemon thread group.
public synchronized boolean isDestroyed() Tests if this thread group has been destroyed.
public void list() Prints information about this thread group to the standard output.
public final boolean parentOf(ThreadGroup g) Tests if this thread group is either the thread group argument or one of its ancestor thread groups.
public final void resume() Resumes all processes in this thread group.
public final void setDaemon(boolean daemon) Changes the daemon status of this thread group.
public final void setMaxPriority(int pri) Sets the maximum priority of the group.
public final void stop() Stops all processes in this thread group.
public final void suspend() Suspends all processes in this thread group.
public String toString() Returns a string representation of this Thread group.
public void uncaughtException(Thread t, Throwable e) Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.

Methods that Apply to the ThreadGroup

The methods that apply to the ThreadGroup itself are:

  • getMaxPriority and setMaxPriority
  • isDaemon and setDaemon
  • getName
  • getParent and parentOf
  • toString

The first two items in the above list apply to attributes of the ThreadGroup that apply to all threads subsequently created as a member of this ThreadGroup. These attributes do not change the attributes of Threads that already are members of the ThreadGroup.

Methods that Apply to all Threads in a ThreadGroup

The methods that apply to all Threads currently in the ThreadGroup are:

  • interrupt
  • stop, suspend, resume (deprecated in JDK 1.2, and should not be used in any JDK)
 
The page was last updated February 19, 2008