/** * Convenience method for registering an MBean and retrieving a proxy for it. * * @param instance MBean instance to be registered * @param intrface the interface this proxy implements * @param name object name of the MBean * @param agentID agent ID of the MBean server this proxy connects to * * @return proxy instance * * @throws MBeanProxyCreationException if the proxy could not be created */ public static Object create(Class instance, Class intrface, ObjectName name, String agentID) throws MBeanProxyCreationException { return create(instance, intrface, name, (MBeanServer)MBeanServerFactory.findMBeanServer(agentID).get(0)); }