Class JMXAccessorInvokeTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
All Implemented Interfaces:
Cloneable

public class JMXAccessorInvokeTask extends JMXAccessorTask
Access JMX JSR 160 MBeans Server.
  • open more then one JSR 160 rmi connection
  • Get/Set Mbeans attributes
  • Call Mbean Operation with arguments
  • Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress
  • Query Mbeans
  • Show Get, Call, Query result at Ant console log
  • Bind Get, Call, Query result at Ant properties
Examples:
  • Get a session attribute hello from session with ref ${sessionid.0} form app Catalina:type=Manager,context=/ClusterTest,host=localhost
       <jmx:invoke
               name="Catalina:type=Manager,context=/ClusterTest,host=localhost"
               operation="getSessionAttribute"
               resultproperty="hello">
             <arg value="${sessionid.0}"/>
             <arg value="Hello"/>
       </jmx:invoke>
     
  • Create new AccessLogger at localhost <jmx:invoke name="Catalina:type=MBeanFactory" operation="createAccessLoggerValve" resultproperty="accessLoggerObjectName" > <arg value="Catalina:type=Host,host=localhost"/> </jmx:invoke>
  • Remove existing AccessLogger at localhost <jmx:invoke name="Catalina:type=MBeanFactory" operation="removeValve" > <arg value="Catalina:type=Valve,name=AccessLogValve,host=localhost"/> </jmx:invoke>

First call to a remote MBeanserver save the JMXConnection a referenz jmx.server

These tasks require Ant 1.6 or later interface.
Since:
5.5.10
Author:
Peter Rossbach