Class JMXAccessorCreateTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class JMXAccessorCreateTask
    extends JMXAccessorTask
    Create new MBean at JMX JSR 160 MBeans Server.
    • Create Mbeans
    • Create Mbeans with parameter
    • Create remote Mbeans with different classloader

    Examples:
    create a new Mbean at jmx.server connection

       <jmx:create
               ref="jmx.server"
               name="Catalina:type=MBeanFactory"
               className="org.apache.catalina.mbeans.MBeanFactory"
               classLoader="Catalina:type=ServerClassLoader,name=server">
                <Arg value="org.apache.catalina.mbeans.MBeanFactory" />
       </jmxCreate/>
     

    WARNINGNot all Tomcat MBeans can create remotely and autoregister by its parents! Please, use the MBeanFactory operation to generate valves and realms.

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

    These tasks require Ant 1.6 or later interface.
    Since:
    5.5.12
    Author:
    Peter Rossbach
    • Constructor Detail

      • JMXAccessorCreateTask

        public JMXAccessorCreateTask()
    • Method Detail

      • getClassLoader

        public java.lang.String getClassLoader()
        Returns:
        Returns the classLoader.
      • setClassLoader

        public void setClassLoader​(java.lang.String classLoaderName)
        Parameters:
        classLoaderName - The classLoader to set.
      • getClassName

        public java.lang.String getClassName()
        Returns:
        Returns the className.
      • setClassName

        public void setClassName​(java.lang.String className)
        Parameters:
        className - The className to set.
      • addArg

        public void addArg​(Arg arg)
      • getArgs

        public java.util.List<Arg> getArgs()
        Returns:
        Returns the args.
      • setArgs

        public void setArgs​(java.util.List<Arg> args)
        Parameters:
        args - The args to set.
      • jmxExecute

        public java.lang.String jmxExecute​(javax.management.MBeanServerConnection jmxServerConnection)
                                    throws java.lang.Exception
        Description copied from class: JMXAccessorTask
        Execute the specified command, based on the configured properties. The input stream will be closed upon completion of this task, whether it was executed successfully or not.
        Overrides:
        jmxExecute in class JMXAccessorTask
        Parameters:
        jmxServerConnection - The JMX connection that should be used
        Returns:
        An error message string in some situations
        Throws:
        java.lang.Exception - if an error occurs
      • jmxCreate

        protected void jmxCreate​(javax.management.MBeanServerConnection jmxServerConnection,
                                 java.lang.String name)
                          throws java.lang.Exception
        Create new MBean from ClassLoader identified by an ObjectName.
        Parameters:
        jmxServerConnection - Connection to the JMX server
        name - MBean name
        Throws:
        java.lang.Exception - Error creating MBean