// query the mbean server
MBeanServerConnection server = getMBeanServer();
Set matches = server.queryNames(new ObjectName(query), null);
log.debug("Query matches: " + matches);
if (matches.size() == 0) {
throw new CommandException("No MBean matches for query: " + query);
}
ObjectName[] names =
(ObjectName[])matches.toArray(new ObjectName[matches.size()]);
return names;