ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Hudak <CHu...@arrowheadgrp.com>
Subject RE: Fire and forget exec task
Date Tue, 27 Nov 2001 22:28:01 GMT
Thanks Denis. That works great.

I guess that I was mislead by the following text in the Ant manual when I
was looing for a solution using parallel:

"Note that while the tasks within the parallel task are being run, the main
thread will be blocked waiting for all the child threads to complete."

This seems to indicate that, since the child task will never complete (as
mentioned below), the main thread will be blocked indefinately.

Charles

-----Original Message-----
From: Denis Hennessy [mailto:denis@network365.com]
Sent: Tuesday, November 27, 2001 2:03 PM
To: 'Ant Developers List'
Subject: RE: Fire and forget exec task


Hi Charles,

You should consider using the <parallel> task which already does what
you want. It allows you to spawn multiple tasks in parallel and execute
independent code in each. An example of using this in included below
which starts an app. server, runs a series of test scripts and then
shuts it down again. I've also added my <waitfor> task which I'm hoping
one of the commiters will consider soon (hint, hint). If you'd like to
try it, it's in the mail archive (or mail me if you want a prebuilt
version.

Regards,
Denis

    <target name="test" depends="deploy, create-test-env">
        <parallel>
            <wlrun beahome="${weblogic.dir}"
                home="${weblogic.dir}/wlserver6.1"
                domain="mydomain"
                classpath="${weblogic.classes}"
                password="weblogic"/>
            <sequential>
                <waitfor maxwait="5m" checkevery="200ms">
                    <http url="http://localhost:7001/index.html"/>
                </waitfor>
                <junit fork="yes" printsummary="yes" haltonfailure="no">
                    <!-- junit config -->
                </junit>
                <wlstop beahome="${weblogic.dir}"
                    classpath="${weblogic.classes}"
                    user="system"
                    url="t3://localhost:7001"
                    password="weblogic"/>
            </sequential>
        </parallel>
    </target>

> -----Original Message-----
> From: Charles Hudak [mailto:CHudak@arrowheadgrp.com] 
> Sent: 27 November 2001 19:02
> To: 'ant-dev@jakarta.apache.org'
> Subject: Fire and forget exec task
> 
> 
> Hi,
> 
> I'm new to the list and I wasn't getting any feedback from 
> the users-list so I'm hoping I can get some feedback here.
> 
> In our developement environment, we are creating custom 
> scripts to automatically deploy new builds to our application 
> servers. This requires us to first stop the server(s), deploy 
> the new web app and then restart the server. The exec task 
> works fine for stopping the server but, as I'm sure you know, 
> doesn't work for starting the server as the process spawned 
> by the exec task doesn't finish and the Ant build hangs.
> 
> I'm wondering if anyone else has encountered a need for the 
> ability to 'fire and forget' an executable during a build or 
> deploy process?
> 
> FWIW, I've hacked the exec task to allow a new attribute 
> 'waitFor' that allows you to control whether the task waits 
> for the spawned process to finish. This value is passed to 
> the Execute object that is created which then either waits 
> for the process to finish and returns the actual exit code or 
> simply returns 0 and allows Ant to continue.
> 
> I encountered one problem, however, in the 
> PumpStreamHandler's stop() method. This method join()'s the 
> I/O stream threads (actually, handlers,
> thereof) of the process which still causes Ant to hang. A 
> workaround is to pass a timeout value to join() so that it 
> doesn't wait forever. This all seems to work. I'm curious if 
> anyone sees any issues in having join() timeout after, say, 
> 500-1000 ms?
> 
> In any event, I'm open for other suggestions on how to craft 
> a solution to this problem so I don't have to do a custom 
> build of Ant to distribute to our development team. Is there 
> any possiblity that these changes might be included in future builds?
> 
> Thanks!
> 
> Charles Hudak
> Software Engineer
> YouZoom, Inc.
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:ant-dev-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message