ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Aston" <>
Subject Re: pingURL: A better way to start and stop application servers?
Date Tue, 11 Feb 2003 14:47:31 GMT

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">
	    <java><!-- start server --></java>

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

However, this doesn't do the same as:

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

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

View raw message