Name: diC59631 Date: 11/06/97
Save the following to MyApplet.java:
----
import java.applet.*;
import java.awt.*;
import java.applet.Applet;
public class MyApplet extends java.applet.Applet
{
public void init()
{
super.init();
setBackground( new Color(0xc0c0c0) );
setLayout( null );
button = new java.awt.Button();
button.setLocation( 29, 17 );
button.setSize( 100, 50 );
add( button );
button.setLabel( "Button" );
list = new java.awt.List();
list.setLocation( 328, 32 );
list.setSize( 100, 200 );
add( list );
textfield = new java.awt.TextField();
textfield.setLocation( 57, 160 );
textfield.setSize( 200, 40 );
add( textfield );
actionAdaptor0 = new ActionAdaptor0();
button.addActionListener(actionAdaptor0);
}
java.awt.Button button;
java.awt.List list;
java.awt.TextField textfield;
ActionAdaptor0 actionAdaptor0;
class ActionAdaptor0 implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
list.addItem(textfield.getText());
}
}
}
----
Save the following to MyApplet.html:
----
<HTML>
<APPLET CODE="MyApplet.class" ALT="The MyApplet Applet" NAME="MyApplet" WIDTH="460" HEIGHT="260" ALIGN="TOP">
</APPLET>
</HTML>
----
DOS% jdb
Initializing jdb...
> stop at MyApplet$ActionAdaptor0:43
Breakpoint set at MyApplet$ActionAdaptor0:43
> run sun.applet.AppletViewer MyApplet.html
running ...
main[1]
{Go to appletviewer and click on the button}
Breakpoint Hit: MyApplet$ActionAdaptor0.actionPerformed (MyApplet$ActionAdaptor0:43)
AWT-EventQueue-0[1] print this$0.component
this$0.component = {jdb hangs}
Analysis:
The AWT-EventQueue and AWT-Windows threads are entering
and exiting the AWT_LOCK all the time, so suspending
either one of them (explicitly or with a breakpoint)
and then asking for information about an AWT object
runs the risk of causing a hang.
Fix:
Not allowing the debugger to suspend a thread that
owns the AWT lock.
(Review ID: 19783)
======================================================================
- duplicates
-
JDK-4182677 Suspending awt threads in java hags system
- Closed
-
JDK-4075012 sun.tools.debug RemoteDebugger.close() often fails to kill debugee process
- Closed