You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Loughran <st...@apache.org> on 2007/11/01 18:12:48 UTC
terminating running builds better
I'm midway through adding the smartfrog features to run ant builds
remotely; buildexceptions will get wrapped and sent back over the wire
to the caller via our friend RMI. as will, ultimately, the logs. you can
use this to run build files as part of a big deployment, and be able to
dynamically tweak the log levels as you go.
one things I'm worrying about is how to stop long-running builds more
cleanly. I'm thinking of an executor that polls some halt variable
between targets, but that does nothing for tasks. Can/should we add
something to project, so that you can actually interrupt project
execution between tasks? We coudl through a BuildInterruptedException.
What do IDEs do to stop ant builds? just kill the thread/process?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: terminating running builds better
Posted by Steve Loughran <st...@apache.org>.
Darin Swanson wrote:
> 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/
well, I'll do the same thing. Now I know it works.
Ant-wise, we could create an interruptable logger that lets you do this
formally; the main reason for doing so would be to add tests for it.
This is clearly an important use case.
>
>
>
>
> Jesse Glick <je...@sun.com>
> Sent by: news <ne...@ger.gmane.org>
> 11/03/2007 01:19 PM
> Please respond to
> "Ant Developers List" <de...@ant.apache.org>
>
>
> 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 <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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: terminating running builds better
Posted by Martijn Kruithof <jk...@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 <je...@sun.com>
> Sent by: news <ne...@ger.gmane.org>
> 11/03/2007 01:19 PM
> Please respond to
> "Ant Developers List" <de...@ant.apache.org>
>
>
> 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 <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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: terminating running builds better
Posted by Darin Swanson <Da...@us.ibm.com>.
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 <je...@sun.com>
Sent by: news <ne...@ger.gmane.org>
11/03/2007 01:19 PM
Please respond to
"Ant Developers List" <de...@ant.apache.org>
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 <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.
--
jesse.glick@sun.com netbeans.org ant.apache.org hudson.dev.java.net
http://google.com/search?q=e%5E%28pi*i%29%2B1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: terminating running builds better
Posted by Jesse Glick <je...@sun.com>.
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.
--
jesse.glick@sun.com netbeans.org ant.apache.org hudson.dev.java.net
http://google.com/search?q=e%5E%28pi*i%29%2B1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: terminating running builds better
Posted by Steve Loughran <st...@apache.org>.
Steve Loughran wrote:
>
>
> I'm midway through adding the smartfrog features to run ant builds
> remotely; buildexceptions will get wrapped and sent back over the wire
> to the caller via our friend RMI. as will, ultimately, the logs. you can
> use this to run build files as part of a big deployment, and be able to
> dynamically tweak the log levels as you go.
>
> one things I'm worrying about is how to stop long-running builds more
> cleanly. I'm thinking of an executor that polls some halt variable
> between targets, but that does nothing for tasks. Can/should we add
> something to project, so that you can actually interrupt project
> execution between tasks? We coudl through a BuildInterruptedException.
>
> What do IDEs do to stop ant builds? just kill the thread/process?
>
of course, a more devious way would be to implement the check-for-halt
logic in a build listener, so that you can retrofit the halting tests to
an out the box ant1.7.0 release; throw a BuildInterruptedException (that
extends BuildException).
what bad things would happen if I threw a BuildException in a
BuildListener.targetstarted() call?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org