如何申请超时到一个Ant任务? [英] How can I apply a timeout to an Ant task?

查看:97
本文介绍了如何申请超时到一个Ant任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无需编写定制Ant任务,有没有使用超时定期Ant目标的一种方式?

Without writing a custom Ant task, is there a way to use a timeout on a regular ant target?

要给予一定的背景信息:我们使用的是删除任务来删除指定目录的内容。
有时候,这个目录是巨大的,有很多生成的文件夹和文件。
我们希望以后有任务超时,说5分钟。

To give some background info: we are using the 'delete' task to remove the contents of a given directory. Sometimes this directory is massive, with lots of generated folders and files. We wanted to have that task timeout after, say, 5 minutes.

推荐答案

您可以使用平行任务,其中有一个超时,具有一个的平行度:

You might use the parallel task, which has a timeout, with a parallel degree of one:

<target name="timed_del">
    <parallel threadCount="1" timeout="300000">
        <sequential>
            ... your tasks here ...
        </sequential>
    </parallel>
</target>

这篇关于如何申请超时到一个Ant任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆