Search code examples
javajbossjmxmbeans

JBoss MBeans: How to have an array attribute?


Is it possible to define a MBean with an array attribute. I currently have an MBean defined as:

<mbean code="corp.app.jmx.DNSServer" name="corp.app:service=DNSServer">
  <attribute name="Server">
    192.168.0.1 192.168.0.2 192.168.0.3
  </attribute>
</mbean>

In the MBean code I then split the String. However - for my next MBean I need to support Strings with spaces in them. I could do a comma-delimited, but I feel sure MBeans will have support for arrays so that I could define them something like this:

<mbean code="corp.app.jmx.DNSServer" name="corp.app:service=DNSServer">
  <attribute name="Server">
    <item>192.168.0.1</item>
    <item>192.168.0.2</item>
    <item>192.168.0.3</item>
  </attribute>
</mbean>

Am I wrong?


Solution

  • Ah - you can define them like this:

    <attribute name="Server">192.168.0.1,192.168.0.2,192.168.0.3</attribute>