The event queue must be silent for one second to initiate a shutdown. This is a hard-coded value in the AWTAutoShutdown class.
So, if your swing timer continues to generate events, less than seconds apart, this will lead to the termination of the application.
Take a look at this example (below). It will not be completed because the thread, even if it is marked as deamon, continues to add events to the queue. If we increase the sleep to 1,500 (1.5 seconds), it will end happily.
public static void main(String[] args) { Thread thread = new Thread(new Runnable() { @Override public void run() { while (true) {
AlexV
source share