Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: javax.swing.Timer blocking program termination Date: Tue, 14 Jul 2015 10:55:20 -0400 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 14 Jul 2015 14:57:36 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="8e164d158183579609bf09837dee5210"; logging-data="12322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AY1kFMPqiWQGSnv/fJU9U4vRJtlnvRXg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 In-Reply-To: Cancel-Lock: sha1:WeZd4lBu6PSUVdR1IkBVL3pWMN8= Xref: csiph.com comp.lang.java.programmer:32010 On 07/14/2015 10:39 AM, e.d.programmer@gmail.com wrote: > > I don't use swing timers personally. I embed my Java in BBj (http://www.basis.com/bbj) which did nothing when I tried to use a swing timer, so I still just use java.util.Timer. > > Closing a window should never terminate a JVM unless you flag it as EXIT_ON_CLOSE which is not recommended. > You may want a timer to be able to do some cleanup after the window closes, > so if the timer is running a process which doesn't need to finish if the > window closes you want to manually stop it in the window close event process. Makes perfect sense to me. But I'm still not sure how a <1 sec timer keeps the EDT alive while a >1 sec timer doesn't - barring explicit stops in windowClosing. > > A method to stop all timers could be useful. It appears you currently have to store a reference to any timers you create if you need to be able to stop them. >