Matrix openmbean

hi,i want to expose a matrix (with a dynamique length ), in my openmbean. can somoene give me an exemple.thanks
[132 byte] By [chnada] at [2007-11-27 0:59:46]
# 1

Hi,

Assuming you want to expose a matrix of longs, on JDK 1.5 you would use a

Long[][] array - on JDK 1.6 you can use a primitive long[][] array.

Below is how you could construct the MBeanInfo for the matrix attributes:

OpenMBeanAttributeInfoSupport[] mattrixAttributes = new OpenMBeanAttributeInfoSupport[] {

new OpenMBeanAttributeInfoSupport("Matrix",

"Matrix",

// Java SE 5.0: need to use Long[][]

// new ArrayType(2,SimpleType.LONG),

// Java SE 6: use long[][]

new ArrayType(1,new ArrayType(SimpleType.LONG,true)),

true,

false,

false),

new OpenMBeanAttributeInfoSupport("Xsize",

"Size on X axis",

SimpleType.INTEGER,

true,

false,

false),

new OpenMBeanAttributeInfoSupport("Ysize",

"Size on Y axis",

SimpleType.INTEGER,

true,

false,

false)

};

Note however that jconsole does not know how to display multidimensional

arrays.

Hope this helps,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-11 23:34:15 > top of Java-index,Core,Monitoring & Management...