Monitoring and Controlling Execution of Threads


The IDE's Threads window (Alt-Shift-7), shown in Figure 7-8, enables you to view the status of threads in the currently debugged program. It also enables you to change the thread that is being monitored in other debugger windows (such as Call Stack and Local Variables) and to suspend individual threads. See Table 7-7 for a guide to the icons used in the Threads window.

Figure 7-8. Threads window


Table 7-7. Key to Icons in the Threads Window

Icon

Meaning

Currently monitored thread

Currently monitored thread group

Running thread

Suspended thread

Thread group


Changing the current thread does not affect the way the program executes.

Switching the Currently Monitored Thread

The contents of the Call Stack and Local Variables windows are dependent on the thread being currently monitored in the debugger (otherwise known as the current thread). To switch the currently monitored thread:

  1. Open the Threads window by pressing Alt-Shift-7.

  2. Right-click the thread that you want to monitor and choose Make Current.

Suspending a Single Thread

By default, when your program hits a breakpoint, all threads are suspended. However, you can also configure a breakpoint so that only its thread is suspended when the breakpoint is hit:

  1. Open the Breakpoints window by pressing Alt-Shift-5.

  2. In the Breakpoints window, right-click the breakpoint and choose Customize.

  3. In the Customize Breakpoint dialog box, select Current from the Suspend combo box.

Isolating Debugging to a Single Thread

By default, all threads in the application are executed in the debugger. If you would like to isolate the debugging so that only one thread is run in the debugger:

  1. Make sure that the thread that you want debugged is designated as the current thread in the Threads window (Alt-Shift-7). The current thread is marked with the icon.

  2. Open the Sessions window by pressing Alt-Shift-6.

  3. In the Sessions window, right-click the session's node and choose Scope | Debug Current Thread.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net