Here you can find the source of queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)
public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, ObjectName objectName) throws Exception
//package com.java2s; //License from project: Open Source License import java.util.Hashtable; import java.util.Set; import javax.management.MBeanServerConnection; import javax.management.ObjectInstance; import javax.management.ObjectName; public class Main { public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, ObjectName objectName) throws Exception { return connection.queryMBeans(objectName, null); }/*from www. ja v a 2s . co m*/ public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, String domain, String name, String type, String scope) throws Exception { return queryConnectionBy(connection, getObjectName(domain, name, type, scope)); } public static ObjectName getObjectName(String domain, String name, String type, String scope) throws Exception { Hashtable<String, String> map = new Hashtable<String, String>(); if (name != null) map.put("name", name); if (type != null) map.put("type", type); if (scope != null) map.put("scope", scope); return ObjectName.getInstance(domain, map); } }