From dev-return-81440-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Sun Nov 04 09:57:45 2007 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 80783 invoked from network); 4 Nov 2007 09:57:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Nov 2007 09:57:45 -0000 Received: (qmail 25558 invoked by uid 500); 4 Nov 2007 09:57:32 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 25513 invoked by uid 500); 4 Nov 2007 09:57:32 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 25502 invoked by uid 99); 4 Nov 2007 09:57:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Nov 2007 01:57:32 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [80.100.149.141] (HELO kruithof.xs4all.nl) (80.100.149.141) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Nov 2007 09:57:36 +0000 Received: from asus.jkf ([192.168.2.5] helo=[127.0.0.1]) by kruithof.xs4all.nl with esmtp (Exim 4.63) (envelope-from ) id 1IocEC-0001Kv-TL for dev@ant.apache.org; Sun, 04 Nov 2007 10:57:13 +0100 Message-ID: <472D9776.1040303@apache.org> Date: Sun, 04 Nov 2007 10:57:10 +0100 From: Martijn Kruithof User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Ant Developers List Subject: Re: terminating running builds better References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org To Recently I have put some effort to remove ignoring thread.interrupt from all kinds of (endless) loops. Interrupting a few times (as other parts may also wait in order to neatly close resources) should now stop ant. Martijn Darin Swanson schreef: > Eclipse is pretty similar to #1. > We have a progress monitor / build listener within which we check to see > if the user has requested to cancel the build. > If the monitor is cancelled we throw a OperationCancelledException which > halts the execution of the build from the Eclipse entry point and reports > the cancelled message to the user. > > Darins > http://www.runnerwhocodes.blogspot.com/ > > > > > Jesse Glick > Sent by: news > 11/03/2007 01:19 PM > Please respond to > "Ant Developers List" > > > To > dev@ant.apache.org > cc > > Subject > Re: terminating running builds better > > > > > > > Steve Loughran wrote: > >> What do IDEs do to stop ant builds? just kill the thread/process? >> > > NB behaves as follows: > > 1. It sets a special flag. The next time any BuildListener/BuildLogger > method is called on the IDE's listener, it will throw a BuildException, > which usually stops the build. > > 2. If several seconds have elapsed with no listener method, or if the > build did not stop for any other reason, Thread.stop is called. > > For example, if is the active task, any output > printed will cause #1 to be triggered. Otherwise, ThreadDeath is caught > by the task, which stops the external process and then rethrows. > > Not perfect but seems to work reasonably well in practice. #2 could > probably be improved to first try Thread.interrupt and only use > Thread.stop as a last resort. > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org