Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exiting the VM automatically (without System.exit())


  • From: s355171@xxxxxxxxxxxxxxxxx (Benjamin Johnston)
  • Subject: Exiting the VM automatically (without System.exit())
  • Date: Sat, 29 Jan 2000 10:25:50 +1000

Hi,

In an application that does not use AWT or Swing, the VM will exit once all
threads (where isDaemon()==false) have finished.

If I do create a new Frame, and then show it (setVisible(true)), even after
hiding and disposing the Frame - the VM will not automatically exit.

I think I have traced the problem to Toolkit.getDefaultToolkit() which, on
my system, creates an instance of sun.awt.windows.WToolkit. JBuilder's
interface decompiler reports that WToolkit imports java.lang.Thread. I'm
guessing that WToolkit creates a new, non-daemon thread (but I don't have
the source), that never finishes (the event dispatcher thread?).

Is it possible to get the system to exit (without calling System.exit(int))
if there are no active (non-daemon) user threads and all windows are
disposed (or not visible)?

Or, would the only solution be a class (and custom thread group) to keep
track of all user threads and windows, and then call System.exit(int)
accordingly? Can all active windows created by the VM be enumerated, 
or must they be registered with some class on creation?

-Benjamin Johnston
s355171@xxxxxxxxxxxxxxxxx



---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx