| Definition:
<path id="catalina_ant">
<fileset dir="${catalina.home}/server/lib">
<include name="catalina-ant.jar"/>
<include name="catalina-ant-jmx.jar"/>
</fileset>
</path>
<typedef
name="jmxCondition"
classname="org.apache.catalina.ant.jmx.JMXAccessorCondition"
classpathref="catalina_ant"/>
<taskdef
name="jmxOpen"
classname="org.apache.catalina.ant.jmx.JMXAccessorTask"
classpathref="catalina_ant"/>
Usage: Wait for start backup node
<target name="wait">
<jmxOpen
host="${jmx.host}" port="${jmx.port}" username="${jmx.username}" password="${jmx.password}" />
<waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" >
<and>
<socket server="${server.name}" port="${server.port}"/>
<http url="${url}"/>
<jmxCondition
name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
operation="=="
attribute="connected" value="true"
/>
<jmxCondition
operation="<"
name="Catalina:j2eeType=WebModule,name=//${tomcat.application.host}${tomcat.application.path},J2EEApplication=none,J2EEServer=none"
attribute="startupTime" value="250"
/>
</and>
</waitfor>
<fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
<echo message="Server ${url} alive" />
</target>
Allowed operation between jmx attribute and reference value:
- == equals
- != not equals
- > greater than (>)
- >= greater than or equals (>=)
- < lesser than (<)
- <= lesser than or equals (<=)
NOTE: For numeric expressions the type must be set and use xml entities as operations.
As type we currently support long and double.
author: Peter Rossbach version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $ since: 5.5.10 |