Configuring Eclipse to debug concurrent code
One of the most useful features of the IDE is debugger. You can perform your application step-by-step and analyze the values of all objects and variables in your program.
If you use the Java programming language, Eclipse is one of the most common Ides. It has a built-in debugger (integrated debugger) that allows you to test your application. By default, the debugger finds a breakpoint (breakpoint) when you test the concurrent application, it simply stops the thread with the breakpoint (breakpoint) and the other threads continue their operation.
In this guide, you will learn how to change the configuration to help test concurrent applications.
Follow these steps to implement the following example:: Select menu Options Window | Preferences. On the left-hand side of the menu, extend the Java option. On the left-hand side of the menu, select the Debug option. The screenshot below shows how the window looks:
Change the value of the default suspend policy to convert suspend Thread to the suspend VM (marked with red in the screenshot) for new breakpoints. Click the OK button to determine the modification. principle
As we mentioned in the introduction to this guide, by default, when you debug concurrent Java applications with eclipse, the debugging process looks for breakpoints, pausing only the threads that first hit the breakpoint, and the other threads will continue their operation.
The following illustration shows the case of the example:
As we mentioned in the introduction to this guide, by default, when you debug concurrent Java applications with eclipse, the debugging process looks for breakpoints, pausing only the threads that first hit the breakpoint, and the other threads will continue their operation.
The following illustration shows the case of the example:
With these changes, you can see that all the threads have been paused. You can continue any thread you want to debugging. Choose the Pause method that best suits your needs.
Turn from: Ifeve