Virtual Machine Threads

 

 

 

Foreword

Resources

Code Listings

Foil Sets

Assignments

Solutions

External Resources

SiteMap

Search

Home

 

 

Up ] Introductory Examples ] Object Cloning ] Static Method's ] Sleep and Locks ] Thread Primer ] Daemon Threads ] Thread Synchronization ] Gaurded Suspension ] Deadlock ] [ Virtual Machine Threads ] Volitility ] Wait-Notify ]

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 ThreadGroup’s parent. As mentioned before, only the initial thread group doesn’t have a parent, and an attempt to get its parent via the getParent() method, returns a null. The recursion ends at this point.

Source

Test.java

Test2.java

cis600.TracerApplet.java

cis600.TracerApplet.java

tracer.html

JAR Files: Please refer to the Java-Basics section for more information on using JAR files.

Test.jar

Test2.jar

Test3.jar