Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4079015

AWT internal thread is non deamon

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.3
    • client-libs
    • None
    • x86
    • windows_95



      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 - ###@###.###
      ======================================================================

            Unassigned Unassigned
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: