Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
AW: pingURL: A better way to start and stop application servers?

AW: pingURL: A better way to start and stop application servers?

2003-02-12       - By Jan.Materne@(protected)

ASAIK there are plans (ideas? wishes?) on the Dev-List for realizing
a async-option (or task) for <java>, <exec> and <apply>.

But I?m not sure - especially when it will be done.


Jan Mat?rne

-----Urspr?ngliche Nachricht-----
Von: Philip Aston [mailto:paston@(protected)]
Gesendet am: Dienstag, 11. Februar 2003 15:48
An: Ant Users List
Betreff: Re: pingURL: A better way to start and stop application
servers?



Philip Aston writes last April:
> [old thread, I've been busy]

Positively historic now.

> Steve Loughran writes:
>  > You can use <waitfor> to probe a url with controlled sleep time
>  > and timeout interval, sets a property on success, etc.
>  >
>  > All pingurl does is add a container wrapper, but it only allows
>  > url 2XX conditions to be evaluated (presumably); <waitfor> can
>  > probe any port for being openable, plus all the other conditions
>  > that are possible
>
> Yep, waitfor is more generic and wins. Roll on 1.5 :-)

I _finally_ got around to trying this. I used something like:

     <target name="start-server">
  <parallel>
   <sequential>
     <java><!-- start server --></java>
   </sequential>

   <waitfor><http url="http://localhost:7001/"/></waitfor>
  </parallel>
     </target>

However, this doesn't do the same as:

     <target name="start-server">
  <pingURL testURL="http://localhost:7001/" waitUntil="alive">
    <java><!-- start server --></java>
        </pingURL>
     </target>

The difference between the two is that the <parallel> construct does
not exit until the server exits, whereas pingURL launches the "start
server" work in its own thread. With pingURL I can have my unit test
targets depend on start-server. AFAICS, I can't achieve the same with
standard ANT tasks.

As a random suggestion, perhaps there could be a "asynchronous" option
for <java> so you could do:

  <java asynchronous="true"><!-- start server --></java>
  <waitfor><http url="http://localhost:7001/"/></waitfor>

Any comments?

- Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.