JMX Task implementations for
Ant (version 1.6 or later) that can be used to interact with the
Remote JMX JSR 160 RMI Adaptor to get/set attributes, invoke MBean operations
and query for Mbeans inside a running instance of Tomcat.See: Description
| Class | Description | 
|---|---|
| Arg | |
| JMXAccessorCondition | Definition:
 
   <path id="catalina_ant">
       <fileset dir="${catalina.home}/server/lib">
           <include name="catalina-ant.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
 ! | 
| JMXAccessorConditionBase | |
| JMXAccessorCreateTask | Create new MBean at JMX JSR 160 MBeans Server. | 
| JMXAccessorEqualsCondition | Definition
 
   <path id="catalina_ant">
       <fileset dir="${catalina.home}/server/lib">
           <include name="catalina-ant.jar"/>
       </fileset>
   </path>
   <typedef
       name="jmxEquals"
       classname="org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition"
       classpathref="catalina_ant"/>
 
 usage: Wait for start backup node
 
     <target name="wait">
        <waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" >
           <and>
               <socket server="${server.name}" port="${server.port}"/>
               <http url="${url}"/>
               <jmxEquals
                   host="localhost" port="9014" username="controlRole" password="tomcat"
                   name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
                   attribute="connected" value="true"
               />
           </and>
       </waitfor>
       <fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
       <echo message="Server ${url} alive" />
   </target>
  | 
| JMXAccessorGetTask | Access JMX JSR 160 MBeans Server. | 
| JMXAccessorInvokeTask | Access JMX JSR 160 MBeans Server. | 
| JMXAccessorQueryTask | Query for Mbeans. | 
| JMXAccessorSetTask | Access JMX JSR 160 MBeans Server. | 
| JMXAccessorTask | Access JMX JSR 160 MBeans Server. | 
| JMXAccessorUnregisterTask | unregister an MBean at JMX JSR 160 MBeans Server. | 
This package contains a set of JMX Task implementations for
Ant (version 1.6 or later) that can be used to interact with the
Remote JMX JSR 160 RMI Adaptor to get/set attributes, invoke MBean operations
and query for Mbeans inside a running instance of Tomcat.  For more information, see
https://tomcat.apache.org/tomcat-7.0-doc/monitoring.html.
Each task element can open a new jmx connection or reference an existing one. The following attribute are exists in every tasks:
| Attribute | Description | 
|---|---|
| url | The JMX Connection URL of the remote Tomcat MBeansServer. | 
| username | The username of an MBeanServer auth, when configured. | 
| password | The password of an MBeanServer auth, when configured. | 
| host | The JMX Connection host. | 
| port | The JMX Connection port. | 
| ref | The name of the ant internal reference for a jmx connection. | 
NOTE - This Tasks only work, when JSR 160 MBean Adaptor as remote jvm is configured.
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.