Name: paC48320 Date: 09/15/97
To reproduce the problem:
Run the following program. I would expect it to stop on exit from Main.main, but it doesn't.
import java.awt.*;
public final class Main
{
public static void main(String[] arguments)
{
Frame frame = new Frame(); /* Note that I do not show this frame */
FileDialog dlg = new FileDialog(frame, "Load File", FileDialog.LOAD);
dlg.show();
System.out.println("Directory name : " + dlg.getDirectory() +
System.getProperty("line.separator") +
"File name: " + dlg.getFile());
dlg.dispose(); /* Just to make sure... */
frame.dispose();
dlg=null; /* Let's be really sure... */
frame=null;
System.gc(); /* This should be enough... */
} /* But NO!!! The program does not exit!!!! */
}
If you investigate further, you will notice that the AWT creates an internal thread but it doesn't flag it as a deamon thread. This is why the application remains suspended.
This thread should be made a deamon, because it is really specific to the implementation of the AWT.
The JLS says that a program exits as soon as all non deamon threads are dead. This problem prevents this from happening (from a programmer's perspective).
company - ACAPS research team , email - ###@###.###
======================================================================