The Need for Worker Threads in a GUI Setting

Chapter 10 - Thread Groups

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Using getParent()
If you need to know which thread group a particular thread group belongs to, you can use the getParent() method on ThreadGroup . Suppose at some time in the past, this code was executed:
ThreadGroup groupD = new ThreadGroup(groupC, groupD);
Then, later in the application, the following code is used:
ThreadGroup parentOfGroupD = groupD.getParent();
The reference returned and stored in parentOfGroupD refers to the same ThreadGroup instance as groupC does.
If getParent() is invoked on the root thread group, null is returned. In the VM, only one instance of ThreadGroup does not have a parent group, and that is the root group.

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net