private static Set<ObjectName> queryObjects(MBeanServerConnection conn,
                                                List<ObjectName> queries) {
        Set<ObjectName> result = new HashSet<>();
        queries.forEach(name -> {
            try {
                result.addAll(conn.queryNames(name, null));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        });
        return result;
    }
A program for reading JMX metrics from a given endpoint.
<p>
This tool only works reliably if the JmxServer is fully initialized prior to invoking the tool.
See KAFKA-4620 for details.
tools/src/main/java/org/apache/kafka/tools/JmxTool.java