From the course: Java's Toughest Bugs
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Debugging steps - Java Tutorial
From the course: Java's Toughest Bugs
Debugging steps
- [Instructor] When working with thread issues, debugging can be difficult because execution hops from one thread to another quickly. However, with the debugger, we can pause the execution to inspect the state of each thread. Let's add a break point at our print statement and run it debug mode. In the call stack, we can see all the threads paused on the break point. For now, let's stick with thread one and consider this thread's execution independently. We'll click step over. Right now, tradeComplete is false, and then it completes. This makes the condition in the while loop false. As a result, this thread will exit the loop and terminate successfully. Let's see thread two's execution. We'll click step over. TradeComplete is still false. Let's keep stepping over, do a few iterations of this loop, and the trade never completes. This means that the condition in the while loop will evaluate to true every single time. In…