This class defines a group of threads and allows operations on the group as a whole. A ThreadGroup may contain Thread objects, as well as "child" ThreadGroup objects. All ThreadGroup objects are created as children of some other ThreadGroup, and thus there is a parent/child hierarchy of ThreadGroup objects.
Some programs may find it convenient to define their own ThreadGroup, but generally thread groups are only used by system-level applications.
public class ThreadGroup extends Object { // Public Constructors public ThreadGroup(String name); public ThreadGroup(ThreadGroup parent, String name); // Public Instance Methods public int activeCount(); public int activeGroupCount(); 1.1public boolean allowThreadSuspension(boolean b); 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(); 1.1public synchronized boolean isDestroyed(); 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(); // Overrides Object public void uncaughtException(Thread t, Throwable e); }
SecurityManager.checkAccess(), Thread(), ThreadGroup(), ThreadGroup.enumerate(), ThreadGroup.parentOf()
SecurityManager.getThreadGroup(), Thread.getThreadGroup(), ThreadGroup.getParent()