0

We can have SimpleType values like SimpleType.INTEGER, SimpleType.STRING in a CompositeData. I want nested composite type i.e. a composite type containing another composite type.

I am using the code below to perform that. But it does not displays the CompositeData in the JConsole. What it displays for me is the metadata of the CompositeData and not the real data.

Please tell me a way to counter the problem.

CompositeType type = new CompositeType("My Type", "My Type", new String[]{"item1", "item2"}, new String[]{"item1", "item2"}, new OpenType[]{SimpleType.STRING, SimpleType.STRING});
CompositeData data = new CompositeDataSupport(type, new String[]{"item1", "item2"}, new String[]{"item value 1", "item value 2"});

CompositeType compType = new CompositeType("compData", "compData", new String[]{"compItem1"}, new String[]{"compItem1"}, new OpenType[]{type});
CompositeData compData = new CompositeDataSupport(compType, new String[]{"compItem1"}, new Object[]{data});
piy26
  • 1,574
  • 11
  • 21

2 Answers2

0

Have you tried Java Mission Control (shipped with 7u40+) instead of JConsole. I believe it's better at displaying more complex data.

Kire Haglin
  • 6,569
  • 22
  • 27
0

It's much easier to handle composite types with MXBeans. You should start there, if you can. You can return more complex objects from methods and attributes; as long as they follow the MXBean rules, you'll get all of the complex type handling for free.

Ross Judson
  • 1,132
  • 5
  • 11