use of javax.management.modelmbean.ModelMBeanAttributeInfo in project camel by apache.
the class MBeanInfoAssembler method getMBeanInfo.
/**
* Gets the {@link ModelMBeanInfo} for the given managed bean
*
* @param defaultManagedBean the default managed bean
* @param customManagedBean an optional custom managed bean
* @param objectName the object name
* @return the model info, or <tt>null</tt> if not possible to create, for example due the managed bean is a proxy class
* @throws JMException is thrown if error creating the model info
*/
public ModelMBeanInfo getMBeanInfo(Object defaultManagedBean, Object customManagedBean, String objectName) throws JMException {
// skip proxy classes
if (defaultManagedBean != null && Proxy.isProxyClass(defaultManagedBean.getClass())) {
LOG.trace("Skip creating ModelMBeanInfo due proxy class {}", defaultManagedBean.getClass());
return null;
}
// maps and lists to contain information about attributes and operations
Map<String, ManagedAttributeInfo> attributes = new LinkedHashMap<String, ManagedAttributeInfo>();
Set<ManagedOperationInfo> operations = new LinkedHashSet<ManagedOperationInfo>();
Set<ModelMBeanAttributeInfo> mBeanAttributes = new LinkedHashSet<ModelMBeanAttributeInfo>();
Set<ModelMBeanOperationInfo> mBeanOperations = new LinkedHashSet<ModelMBeanOperationInfo>();
Set<ModelMBeanNotificationInfo> mBeanNotifications = new LinkedHashSet<ModelMBeanNotificationInfo>();
// extract details from default managed bean
if (defaultManagedBean != null) {
extractAttributesAndOperations(defaultManagedBean.getClass(), attributes, operations);
extractMbeanAttributes(defaultManagedBean, attributes, mBeanAttributes, mBeanOperations);
extractMbeanOperations(defaultManagedBean, operations, mBeanOperations);
extractMbeanNotifications(defaultManagedBean, mBeanNotifications);
}
// extract details from custom managed bean
if (customManagedBean != null) {
extractAttributesAndOperations(customManagedBean.getClass(), attributes, operations);
extractMbeanAttributes(customManagedBean, attributes, mBeanAttributes, mBeanOperations);
extractMbeanOperations(customManagedBean, operations, mBeanOperations);
extractMbeanNotifications(customManagedBean, mBeanNotifications);
}
// create the ModelMBeanInfo
String name = getName(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName);
String description = getDescription(customManagedBean != null ? customManagedBean : defaultManagedBean, objectName);
ModelMBeanAttributeInfo[] arrayAttributes = mBeanAttributes.toArray(new ModelMBeanAttributeInfo[mBeanAttributes.size()]);
ModelMBeanOperationInfo[] arrayOperations = mBeanOperations.toArray(new ModelMBeanOperationInfo[mBeanOperations.size()]);
ModelMBeanNotificationInfo[] arrayNotifications = mBeanNotifications.toArray(new ModelMBeanNotificationInfo[mBeanNotifications.size()]);
ModelMBeanInfo info = new ModelMBeanInfoSupport(name, description, arrayAttributes, null, arrayOperations, arrayNotifications);
LOG.trace("Created ModelMBeanInfo {}", info);
return info;
}
use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.
the class OPerformanceStatisticManagerMBean method populateCommitTime.
private void populateCommitTime(List<MBeanAttributeInfo> performanceAttributes) {
final MBeanAttributeInfo commitTime = new ModelMBeanAttributeInfo(COMMIT_TIME, long.class.getName(), "Average commit time in nanoseconds", true, false, false);
performanceAttributes.add(commitTime);
}
use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.
the class OPerformanceStatisticManagerMBean method populateWriteSpeedInCache.
private void populateWriteSpeedInCache(List<MBeanAttributeInfo> performanceAttributes, Collection<String> components) {
final MBeanAttributeInfo writeSpeedInCache = new ModelMBeanAttributeInfo(WRITE_SPEED_IN_CACHE, long.class.getName(), "Write speed to disk cache in pages per second", true, false, false);
performanceAttributes.add(writeSpeedInCache);
for (String component : components) {
final MBeanAttributeInfo componentWriteSpeedInCache = new ModelMBeanAttributeInfo(WRITE_SPEED_IN_CACHE + COMPONENT_SEPARATOR + component, long.class.getName(), "Write speed to disk cache in pages per second for component " + component, true, false, false);
performanceAttributes.add(componentWriteSpeedInCache);
}
}
use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.
the class OPerformanceStatisticManagerMBean method populateExclusiveWriteCacheSize.
private void populateExclusiveWriteCacheSize(List<MBeanAttributeInfo> performanceAttributes) {
final MBeanAttributeInfo exclusiveWriteCacheSize = new ModelMBeanAttributeInfo(EXCLUSIVE_WRITE_CACHE_SIZE, long.class.getName(), "Size of exclusive part of write cache in bytes", true, false, false);
performanceAttributes.add(exclusiveWriteCacheSize);
}
use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.
the class OPerformanceStatisticManagerMBean method populateWALCacheOverflowCount.
private void populateWALCacheOverflowCount(List<MBeanAttributeInfo> performanceAttributes) {
final MBeanAttributeInfo walCacheOverflowCount = new ModelMBeanAttributeInfo(WAL_CACHE_OVERFLOW_COUNT, long.class.getName(), "Count of times when there was not enough space in WAL to keep already written data", true, false, false);
performanceAttributes.add(walCacheOverflowCount);
}
Aggregations