本文整理匯總了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();
}
}