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: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: javax.swing.Timer blocking program termination Date: Tue, 14 Jul 2015 15:08:11 -0700 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 14 Jul 2015 22:06:44 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e4bb2c7dad0e79edbbf184ec68513a50"; logging-data="19749"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18w9E1SW4B2Bv5UOkRmW/JH" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: Cancel-Lock: sha1:NS/V/ft4oP/wf48EDsLOhAiz5rw= Xref: csiph.com comp.lang.java.programmer:32026 On 7/14/2015 14:51, Martin Gregorie wrote: > That looks reasonable to me. Better than my supposition, certainly: I was > speculating that, because there are two threads running you could get out > of order execution between stuff passed to the EDT to initialise and > stuff run directly by the 'main' (implied) thread. And, of course, I > forgot that the timer is running on the EDT. That's one of the issues, the timer doesn't run on the EDT, it just schedules its work on the EDT. "Although all Timers perform their waiting using a single, shared thread (created by the first Timer object that executes), the action event handlers for Timers execute on another thread -- the event-dispatching thread." It's not clear to me what "executes" is either, does that mean start() is called on a timer or a timer has reached the initial delay and called one of the event handlers? -- Knute Johnson