Java Tools Tutorials - Herong's Tutorial Notes - Version 5.32, by Dr. Herong Yang
Stepping through Statements of a Child Thread
This section provides a tutorial example on how to step through execution statements of the child thread in a multi-thread application.
2. Stepping through statements in the sub thread:
Thread-0[1] where all
Attach Listener:
Signal Dispatcher:
Finalizer:
[1] java.lang.Object.wait (native method)
[2] java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:142)
[3] java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:158)
[4] java.lang.ref.Finalizer$FinalizerThread.run (Finalizer.java:209)
Reference Handler:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:502)
[3] java.lang.ref.Reference$ReferenceHandler.run (Reference.java:157)
main:
[1] java.lang.Thread.sleep (native method)
[2] PrimeNumberSeeker.main (PrimeNumberSeeker.java:21)
Thread-0:
[1] PrimeNumberSeeker.run (PrimeNumberSeeker.java:28)
Thread-0[1] next
2, 2, 0
>
Step completed: "thread=Thread-0", PrimeNumberSeeker.run(), line=29
29 while (count < ceiling) {
Thread-0[1] where all
...
main:
[1] java.lang.Thread.sleep (native method)
[2] PrimeNumberSeeker.main (PrimeNumberSeeker.java:21)
Thread-0:
[1] PrimeNumberSeeker.run (PrimeNumberSeeker.java:29)
Thread-0[1] next
3, 2, 0
>
Step completed:
"thread=Thread-0", PrimeNumberSeeker.run(), line=30 bci=17
30 current++;
Thread-0[1] next
4, 3, 0
>
Step completed:
"thread=Thread-0", PrimeNumberSeeker.run(), line=31 bci=27
31 int j = 2;
Thread-0[1] next
5, 3, 0
>
Step completed:
"thread=Thread-0", PrimeNumberSeeker.run(), line=32 bci=29
32 boolean isPrime = true;
Thread-0[1] next
6, 3, 0
>
Step completed:
"thread=Thread-0", PrimeNumberSeeker.run(), line=33 bci=31
33 while (j<current/2 && isPrime) {
Thread-0[1] list
29 while (count < ceiling) {
30 current++;
31 int j = 2;
32 boolean isPrime = true;
33 => while (j<current/2 && isPrime) {
34 isPrime = current % j > 0;
35 j++;
36 }
37 if (isPrime) {
38 count++;
Thread-0[1] print current
current = 3
What I have done here:
Last update: 2015.
Table of Contents
'javac' - The Java Program Compiler
'java' - The Java Program Launcher
'jdb' - Java Debugger Command and Options
Starting a Debugging Session with 'jdb'
Debugging Applications with Separate 'jdb' Sessions
Debugging Java Applications Remotely
Listing Debugging Commands with 'help' Command
PrimeNumberSeeker.java - Multi-Thread Sample Program
Starting Debugging Session on a Multi-Thread Application
►Stepping through Statements of a Child Thread
Checking Variable Values in a Debugging Session
Debugging the Main Thread of a Multi-Thread Application
Switching Execution Threads in a Debugging Session
Suspending Main Thread to Debug Child Thread
'jconsole' - Java Monitoring and Management Console
'jstat' - JVM Statistics Monitoring Tool
jvisualvm (Java VisualVM) - JVM Visual Tool
'javap' - The Java Class File Disassembler
'keytool' - Public Key Certificate Tool