JDK-4196724 : AWT Daemon Thread never finishes
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.1.6,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_95
  • CPU: generic,x86
  • Submitted: 1998-12-10
  • Updated: 1999-08-17
  • Resolved: 1999-08-17
Related Reports
Duplicate :  
Description

Name: dbT83986			Date: 12/10/98


This is a major problem with the current versions
of the JDK 1.1.7A and 1.2.x betas, and seriously affects
100% pure running ability.

The problem is that once used, the AWT Thread never
terminates, causing the users to have to use System.exit()
to stop a program from running. From the 100% Pure site,
this is A BAD THING.

The AWT Thread should be marked as a Daemon once all
the event queue has been processed and there are no more
visible windows. If any further events are generated,
then they will be inserted into the queue, forcing the
AWT Thread to continue running even if another thread finishes.

Example:

public class ThisBuggersUpTheAWTAndTheWholeConceptOfPureCode {
  public static void main(String args[]) {
    Frame f = new Frame("Bugger this for a larf");
    f.setSize(200,200);
    f.setLocation(0,0);
    f.setVisible(true);
    f.dispose();
    // you'd have thought you woudln't need the next line
    // System.exit(0);
  }
}
This just hangs the system, and the user must Ctrl+C
to break out of it.
(Review ID: 42138)
======================================================================

Comments
WORK AROUND Name: dbT83986 Date: 12/10/98 So simple. Mark the AWT Thread as a daemon thread iff - there is nothing left visible on the screen (no events can be generated) - there is nothing left in the input queue If either of these don't hold, then mark it as a non-Daemon ======================================================================
11-06-2004