ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darin Swanson <>
Subject Re: terminating running builds better
Date Sat, 03 Nov 2007 22:57:01 GMT
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.


Jesse Glick <> 
Sent by: news <>
11/03/2007 01:19 PM
Please respond to
"Ant Developers List" <>


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 <java fork="true"> 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:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message