|
|
We now try and list the threads that are forked off by the Java Virtual machine. Before we proceed further a brief explanation of the ThreadGroup class is in order. A thread group represents a set of threads. In addition, a thread group can also include other thread groups. The thread groups form a tree in which every thread group except the initial thread group (the SystemThreadGroup) has a parent. The method of primary interest to us, in the preceding code listing, is the listThreadsInfo() method. This method recursively lists the Threads present within a ThreadGroup, and then proceeds to list the same information for the ThreadGroups parent. As mentioned before, only the initial thread group doesnt have a parent, and an attempt to get its parent via the getParent() method, returns a null. The recursion ends at this point. Source
JAR Files: Please refer to the Java-Basics section for more information on using JAR files.
|