/** List all MBeans and their attributes. */ public static void listMBeans(MBeanServerConnection server) throws IOException { final Set names = server.queryNames(null, null); for (final Iterator i = names.iterator(); i.hasNext(); ) { ObjectName name = (ObjectName) i.next(); System.out.println("Got MBean: " + name); try { MBeanInfo info = server.getMBeanInfo((ObjectName) name); MBeanAttributeInfo[] attrs = info.getAttributes(); if (attrs == null) continue; for (int j = 0; j < attrs.length; j++) { if (attrs[j].isReadable()) { try { Object o = server.getAttribute(name, attrs[j].getName()); System.out.println("\t\t" + attrs[j].getName() + " = " + o); } catch (Exception x) { System.err.println("JmxClient failed to get " + attrs[j].getName()); x.printStackTrace(System.err); } } } } catch (Exception x) { System.err.println("JmxClient failed to get MBeanInfo: " + x); x.printStackTrace(System.err); } } }
public ExoticMBeanInfo(MBeanInfo mbi) { super( mbi.getClassName(), mbi.getDescription(), mbi.getAttributes(), mbi.getConstructors(), mbi.getOperations(), mbi.getNotifications()); }