| ||||
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 |