ThreadGroup

Name

ThreadGroup

Synopsis

Description

The ThreadGroup class implements a grouping scheme for threads. A ThreadGroup object can own Thread objects and other ThreadGroup objects. The ThreadGroup class provides methods that allow a ThreadGroup object to control its Thread and ThreadGroup objects as a group. For example, suspend() and resume() methods of a ThreadGroup object call the suspend() and resume() methods of each of the Thread and ThreadGroup objects that belong to the particular ThreadGroup.

When a Java program starts, a ThreadGroup object is created to own the first Thread. Any additional ThreadGroup objects are explicitly created by the program.

Class Summary

public class java.lang.ThreadGroup extends java.lang.Object {
 // Constructors public ThreadGroup(String name);
public ThreadGroup(ThreadGroup parent, String name; // Instance Methods public int activeCount();
public int activeGroupCount();
public boolean allowThreadSuspension(boolean b); // New in 1.1 public final void checkAccess();
public final void destroy();
public int enumerate(Thread list[]);
public int enumerate(Thread list[], boolean recurse);
public int enumerate(ThreadGroup list[]);
public int enumerate(ThreadGroup list[], boolean recurse);
public final int getMaxPriority();
public final String getName();
public final ThreadGroup getParent();
public final boolean isDaemon();
public synchronized boolean isDestroyed(); // New in 1.1 public void list();
public final boolean parentOf(ThreadGroup g);
public final void resume();
public final void setDaemon(boolean daemon);
public final void setMaxPriority(int pri);
public final void stop();
public final void suspend();
public String toString();
public void uncaughtException(Thread t, Throwable e);
}

Constructors

ThreadGroup

public ThreadGroup(String name)

public ThreadGroup(ThreadGroup parent, String name)

Instance Methods

activeCount

public int activeCount()

activeGroupCount

public int activeGroupCount()

allowThreadSuspension

public boolean allowThreadSuspension(boolean b)

checkAccess

public final void checkAccess()

destroy

public final void destroy()

enumerate

public int enumerate(Thread list[])

public int enumerate(Thread list[], boolean recurse)

public int enumerate(ThreadGroup list[])

public int enumerate(Thread list[], boolean recurse)

getMaxPriority

public final int getMaxPriority()

getName

public final String getName()

getParent

public final ThreadGroup getParent()

isDaemon

public final boolean isDaemon()

isDestroyed

public synchronized boolean isDestroyed()

list

public void list()

parentOf

public final boolean parentOf(ThreadGroup g)

resume

public final void resume()

setDaemon

public final void setDaemon(boolean daemon)

setMaxPriority

public final void setMaxPriority(int pri)

stop

public final void stop()

suspend

public final void suspend()

toString

public String toString()

uncaughtException

public void uncaughtException(Thread t, Throwable e)

Inherited Methods

Method Inherited From Method Inherited From
clone() Object equals(Object) Object
finalize() Object getClass() Object
hashCode() Object notify() Object
notifyAll() Object wait() Object
wait(long) Object wait(long, int) Object

See Also

Exceptions; Object; Runnable; SecurityManager; Thread; Threads 8; Throwable