本文整理汇总了Java中com.j256.simplejmx.common.JmxResource类的典型用法代码示例。如果您正苦于以下问题:Java JmxResource类的具体用法?Java JmxResource怎么用?Java JmxResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JmxResource类属于com.j256.simplejmx.common包,在下文中一共展示了JmxResource类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import com.j256.simplejmx.common.JmxResource; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
// do the annotations
Map<String, Object> beans = applicationContext.getBeansOfType(null);
for (Object bean : beans.values()) {
// this seems to happen with MethodInvokingFactoryBean and maybe others
if (bean == null) {
continue;
}
// we handle @JmxResource annotations or JmxSelfNaming
ObjectName objectName = null;
// check for more specific classes first
if (bean instanceof JmxBean) {
JmxBean jmxBean = (JmxBean) bean;
objectName =
jmxServer.register(jmxBean.getTarget(), jmxBean.getJmxResourceInfo(),
jmxBean.getAttributeFieldInfos(), jmxBean.getAttributeMethodInfos(),
jmxBean.getOperationInfos());
} else if (bean instanceof PublishAllBeanWrapper) {
objectName = jmxServer.register((PublishAllBeanWrapper) bean);
} else if (bean instanceof JmxSelfNaming) {
objectName = jmxServer.register((JmxSelfNaming) bean);
} else if (bean.getClass().isAnnotationPresent(JmxResource.class)) {
objectName = jmxServer.register(bean);
}
if (objectName != null) {
registeredBeans.add(objectName);
}
}
}
示例2: getObjectDescription
import com.j256.simplejmx.common.JmxResource; //导入依赖的package包/类
private String getObjectDescription(Object obj) {
Class<? extends Object> clazz = obj.getClass();
JmxResource jmxResource = clazz.getAnnotation(JmxResource.class);
if (jmxResource == null || jmxResource.description() == null || jmxResource.description().length() == 0) {
return null;
} else {
return jmxResource.description();
}
}