开发者

how to specify jmx mbean to render it as a tree in jconsole?

My application has a specific set of keys for which I monitor values(min, max, etc..). It looks very similar to the following:

 public class Data implements Serializable{
    int max, min; //etc..
 }

 public interface HelloMBean{
     String [] getKeys();
     Data getDataForKey(String);
     Data [] getDatas();
 }

However, I am not able to see the Keys or Datas attribute using jconsole(I always see a 'not available' value for those properties).

How should I structure my bean definition so that it would displayed as a tree of values ?

HelloMBean
|- attributes
     |----开发者_如何学JAVA key1
     |---- key2

I would like to display the values(eg: key1.max or key2.min) as a graph as well. Is this possible? If so, what would be the best way to achieve it?

Thanks!


Isn't the javax.management.openmbean.CompositeData that you want?

It is "unavailable" because the jconsole doesn't have Data class available, it doesn't know anything about the class.

Or if you want create each "key" as separate attribute, you could make your own implementation of the DynamicMBean which returns simple structures with primitive types like int. E.g. there is example here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜