3 Replies Latest reply on Mar 12, 2004 10:27 AM by Dustin Barlow

    How to anotate params in an mbean method (so jmx console see

    Brian Tarbox Newbie

      I have a set of MBeans, which have assorted methods.
      When I go to JMX MBean View I see the methods along with their parameters..but all it says for each param is the type and the text "MBean Operation Parameter".

      Where can I specify the parameter name so the user of the JMX console can see it?

      Thank you.

      Brian Tarbox

        • 1. Re: How to anotate params in an mbean method (so jmx console
          Scott Stark Master

          You need to use a DynamicMBean to supply this information. The JBoss XMBean is the easiest way to to this.

          • 2. Re: How to anotate params in an mbean method (so jmx console
            Dustin Barlow Newbie

            If you use XDoclet (and if you don't, you should), it's pretty simple to create the Model XMBean for JBoss with param annotations.

            For example:

            /**
            * @jmx:mbean name="MyApplication:service=MyJMX"
            * @jboss.service servicefile="jboss"
            * @jboss.xmbean
            */
            public class MyJMX implements MyJMXMBean {
            /** @jmx:managed-operation description="Init the MyJMX MBean" */
            public void init() {};
            /** @jmx:managed-operation description="Start the MyJMX MBean" */
            public void start() {};
            /** @jmx:managed-operation description="Stop the MyJMX MBean" */
            public void stop() {};
            /** @jmx:managed-operation description="Destroy the MyJMX MBean" */
            public void destroy() {};
            /**
            * @jmx:managed-operation description="My doSomething method"
            * @jmx.managed-parameter name="key" type="java.lang.String" description=“Key of Task”
            */
            public void doSomething(Object key) {
            // Do something useful with key
            }
            }


            Then add the "jbossxmbean" sub-task tag to your jmxdoclet ant task, and you should be good to go. I'd post the actual Ant task, but this silly JBoss forum tool doesn't handle XML in the message at all.

            • 3. Re: How to anotate params in an mbean method (so jmx console
              Dustin Barlow Newbie

              Slight correction:

              This line:
              * @jmx.managed-parameter name="key" type="java.lang.String" description=“Key of Task”

              should read:

              * @jmx.managed-parameter name="key" type="java.lang.String" description="Key of Task";