/**
* Retrieve a new proxy MBean
*
* @return A new proxy MBean of the same type with which the class was constructed
*/
public <T> T getProxyMBean(Class<T> proxyClass, String beanQueryName)
throws MalformedObjectNameException, IOException {
ObjectName name = null;
QueryExp query = null;
if (proxyClass != null) {
query = Query.isInstanceOf(Query.value(proxyClass.getName()));
}
if (beanQueryName != null) {
name = ObjectName.getInstance(beanQueryName);
}
Set<ObjectInstance> beans = con.queryMBeans(name, query);
assertEquals("failed to find only one instance of type " + proxyClass.getName() + " with name "
+ beanQueryName, 1, beans.size());
return JMX.newMXBeanProxy(con, ((ObjectInstance) beans.toArray()[0]).getObjectName(),
proxyClass);
}
MBeanServerConnectionRule.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:monarch
作者:
评论列表
文章目录