564 threadMBean = null;
565 sunOperatingSystemMXBean = null;
566 garbageCollectorMBeans = null;
567 // Set connection state to DISCONNECTED
568 if (!isDead) {
569 isDead = true;
570 setConnectionState(ConnectionState.DISCONNECTED);
571 }
572 }
573
574 /**
575 * Returns the list of domains in which any MBean is
576 * currently registered.
577 */
578 public String[] getDomains() throws IOException {
579 return server.getDomains();
580 }
581
582 /**
583 * Returns a map of MBeans with ObjectName as the key and MBeanInfo value
584 * of a given domain. If domain is <tt>null</tt>, all MBeans
585 * are returned. If no MBean found, an empty map is returned.
586 *
587 */
588 public Map<ObjectName, MBeanInfo> getMBeans(String domain)
589 throws IOException {
590
591 ObjectName name = null;
592 if (domain != null) {
593 try {
594 name = new ObjectName(domain + ":*");
595 } catch (MalformedObjectNameException e) {
596 // should not reach here
597 assert(false);
598 }
599 }
600 Set<ObjectName> mbeans = server.queryNames(name, null);
601 Map<ObjectName,MBeanInfo> result =
602 new HashMap<ObjectName,MBeanInfo>(mbeans.size());
603 Iterator<ObjectName> iterator = mbeans.iterator();
604 while (iterator.hasNext()) {
|
564 threadMBean = null;
565 sunOperatingSystemMXBean = null;
566 garbageCollectorMBeans = null;
567 // Set connection state to DISCONNECTED
568 if (!isDead) {
569 isDead = true;
570 setConnectionState(ConnectionState.DISCONNECTED);
571 }
572 }
573
574 /**
575 * Returns the list of domains in which any MBean is
576 * currently registered.
577 */
578 public String[] getDomains() throws IOException {
579 return server.getDomains();
580 }
581
582 /**
583 * Returns a map of MBeans with ObjectName as the key and MBeanInfo value
584 * of a given domain. If domain is {@code null}, all MBeans
585 * are returned. If no MBean found, an empty map is returned.
586 *
587 */
588 public Map<ObjectName, MBeanInfo> getMBeans(String domain)
589 throws IOException {
590
591 ObjectName name = null;
592 if (domain != null) {
593 try {
594 name = new ObjectName(domain + ":*");
595 } catch (MalformedObjectNameException e) {
596 // should not reach here
597 assert(false);
598 }
599 }
600 Set<ObjectName> mbeans = server.queryNames(name, null);
601 Map<ObjectName,MBeanInfo> result =
602 new HashMap<ObjectName,MBeanInfo>(mbeans.size());
603 Iterator<ObjectName> iterator = mbeans.iterator();
604 while (iterator.hasNext()) {
|