ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Aston" <pas...@bea.com>
Subject pingURL: A better way to start and stop application servers?
Date Thu, 04 Apr 2002 16:43:58 GMT

Hi,

I thought folks might be interested in the attached task, pingURL. It
was inspired by the cactus runservertests task, which I've tweaked in
the past. IMHO, its syntactically neater though.

Here's how I use it to start with WLS 6.1:

    <pingURL testURL="http://localhost:7001/" waitUntil="alive">
        <java classname="weblogic.Server" fork="yes" dir="${wls.dir}"
              maxmemory="64m" output="${wls.dir}/stdout.log">
          <sysproperty key="bea.home" path="${bea.home}"/>
          <sysproperty key="java.library.path" path="${wls.libpath}"/>
          <classpath path="${wls.classpath}"/>
        </java>
    </pingURL>


and to stop WLS 6.1:

    <pingURL testURL="http://localhost:7001/" waitUntil="dead">
       <java classname="weblogic.Admin" fork="yes"> <!-- Fork or die :-( -->
         <classpath path="${wls.classpath}"/>
         <arg line="-url t3://localhost:7001 -username system -password password SHUTDOWN"/>
       </java>
    </pingURL>


What's it do?

When started with waitUntil="alive":

     1. Pings the testURL, and returns immediately if it can connect.

     2. Otherwise, it runs all its nested tasks in a separate thread
     and then..

     3. .. pings the testURL every half a second and doesn't return
     until a response is received.


When started with waitUntil="dead":

     1. Pings the testURL, and returns immediately if it cannot connect.

     2. Otherwise, it runs all its nested tasks in a separate thread
     and then..

     3. .. pings the testURL every half a second and doesn't return
     until a response is not received.


The functionality of pingURL is actually orthogonal to that of wlrun
and wlstop. If they work for you, you can of course say things like:

  <pingURL testURL="http://localhost:7001/" waitUntil="alive">
    <wlrun...>
  </pingURL>


[For the interested, here's why I avoid wlrun and wlstop:

Problems with the standard wlrun target:
       1. It is synchronous, doesn't allow you to do anything
          until WLS exits unless you use <parallel>
       2. No way of setting shared library path in OS independent way.
       3. It makes bogus assumptions about the relation of WLS
          run time directory and WLS installation.

Problems with the standard wlstop target:
       1. It doesn't wait until the server is dead.
       2. It doens't work with WLS 6.1

and both of them require you to obtain new versions of the task
whenever the server start/stop protocol changes.]

I'm quite willing to submit pingURL as an optional package if people
think its generally useful. It may need a more meaningful name, anyone
got a better than suggestion?


- Phil


Mime
View raw message