简体   繁体   English

如何在另一个线程中执行Ant任务

[英]How to execute Ant task in another thread

My ant has two target A and B, target A copies a bunch of files to a location, and target checks the copied files in that location. 我的蚂蚁有两个目标A和B,目标A将一堆文件复制到一个位置,然后目标检查在该位置复制的文件。

The problem is that, A needs sometime to complete its execution, but B should wait either blindly (eg, 30 seconds) or wisely (eg, check a var/property indicating the finish of task A) to continue its process. 问题在于,A需要一段时间才能完成其执行,但是B应该盲目地(例如30秒)或明智地等待(例如,检查表示任务A完成的变量/属性)以继续其过程。

I tried both sleep and wait, but it seems that both of them block the whole thread, so during the wait of target "execute_task", target A is also blocked, so the file copy is in sleep/wait mode. 我尝试了睡眠和等待,但是似乎它们都阻塞了整个线程,因此在目标“ execute_task”的等待期间,目标A也被阻塞,因此文件副本处于睡眠/等待模式。

How should I process, to let target A continues its copy mission, and hold B to wait for a while till A is complete? 我应该如何处理,以使目标A继续执行其复制任务,并让B等待一段时间,直到A完成?

thanks a lot! 非常感谢!

<target name="execute_task">

    <antcall target="A_copy_files"></antcall>
    <antcall target="B_exam_files" ></antcall>

    <waitfor maxwait="30" maxwaitunit="second" timeoutproperty="signal_build_timeout1">
        <istrue value="${set_for_deploy_done}"/>
    </waitfor>
    <antcall target="B_exam_files" ></antcall>

</target>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM