Search in sources :

Example 41 with ModelMBeanAttributeInfo

use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.

the class OPerformanceStatisticManagerMBean method populateWriteCacheOverflowCount.

private void populateWriteCacheOverflowCount(List<MBeanAttributeInfo> performanceAttributes) {
    final MBeanAttributeInfo writeCacheOverflowCount = new ModelMBeanAttributeInfo(WRITE_CACHE_OVERFLOW_COUNT, long.class.getName(), "Count of times when there was not enough space in write cache to keep already written data", true, false, false);
    performanceAttributes.add(writeCacheOverflowCount);
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo)

Example 42 with ModelMBeanAttributeInfo

use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.

the class OPerformanceStatisticManagerMBean method populateReadSpeedFromCache.

private void populateReadSpeedFromCache(List<MBeanAttributeInfo> performanceAttributes, Collection<String> components) {
    final MBeanAttributeInfo readSpeedFromCache = new ModelMBeanAttributeInfo(READ_SPEED_FROM_CACHE, long.class.getName(), "Read speed from disk cache in pages per second", true, false, false);
    performanceAttributes.add(readSpeedFromCache);
    for (String component : components) {
        final MBeanAttributeInfo componentReadSpeedFromCache = new ModelMBeanAttributeInfo(READ_SPEED_FROM_CACHE + COMPONENT_SEPARATOR + component, long.class.getName(), "Read speed from disk cache in pages per second for component " + component, true, false, false);
        performanceAttributes.add(componentReadSpeedFromCache);
    }
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo)

Example 43 with ModelMBeanAttributeInfo

use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.

the class OPerformanceStatisticManagerMBean method populateWriteCacheFlushOperationsTime.

private void populateWriteCacheFlushOperationsTime(List<MBeanAttributeInfo> performanceAttributes) {
    final MBeanAttributeInfo flushOperationsTime = new ModelMBeanAttributeInfo(WRITE_CACHE_FLUSH_OPERATION_TIME, long.class.getName(), "Time which is spent on each flush operation", true, false, false);
    performanceAttributes.add(flushOperationsTime);
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo)

Example 44 with ModelMBeanAttributeInfo

use of javax.management.modelmbean.ModelMBeanAttributeInfo in project orientdb by orientechnologies.

the class OPerformanceStatisticManagerMBean method populateFullCheckpointCount.

private void populateFullCheckpointCount(List<MBeanAttributeInfo> performanceAttributes) {
    final MBeanAttributeInfo fullCheckpointCount = new ModelMBeanAttributeInfo(FULL_CHECKPOINT_COUNT, long.class.getName(), "Amount of times full checkpoints were executed by storage", true, false, false);
    performanceAttributes.add(fullCheckpointCount);
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo)

Example 45 with ModelMBeanAttributeInfo

use of javax.management.modelmbean.ModelMBeanAttributeInfo in project spring-framework by spring-projects.

the class AbstractReflectiveMBeanInfoAssembler method getAttributeInfo.

/**
	 * Iterate through all properties on the MBean class and gives subclasses
	 * the chance to vote on the inclusion of both the accessor and mutator.
	 * If a particular accessor or mutator is voted for inclusion, the appropriate
	 * metadata is assembled and passed to the subclass for descriptor population.
	 * @param managedBean the bean instance (might be an AOP proxy)
	 * @param beanKey the key associated with the MBean in the beans map
	 * of the {@code MBeanExporter}
	 * @return the attribute metadata
	 * @throws JMException in case of errors
	 * @see #populateAttributeDescriptor
	 */
@Override
protected ModelMBeanAttributeInfo[] getAttributeInfo(Object managedBean, String beanKey) throws JMException {
    PropertyDescriptor[] props = BeanUtils.getPropertyDescriptors(getClassToExpose(managedBean));
    List<ModelMBeanAttributeInfo> infos = new ArrayList<>();
    for (PropertyDescriptor prop : props) {
        Method getter = prop.getReadMethod();
        if (getter != null && getter.getDeclaringClass() == Object.class) {
            continue;
        }
        if (getter != null && !includeReadAttribute(getter, beanKey)) {
            getter = null;
        }
        Method setter = prop.getWriteMethod();
        if (setter != null && !includeWriteAttribute(setter, beanKey)) {
            setter = null;
        }
        if (getter != null || setter != null) {
            // If both getter and setter are null, then this does not need exposing.
            String attrName = JmxUtils.getAttributeName(prop, isUseStrictCasing());
            String description = getAttributeDescription(prop, beanKey);
            ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(attrName, description, getter, setter);
            Descriptor desc = info.getDescriptor();
            if (getter != null) {
                desc.setField(FIELD_GET_METHOD, getter.getName());
            }
            if (setter != null) {
                desc.setField(FIELD_SET_METHOD, setter.getName());
            }
            populateAttributeDescriptor(desc, getter, setter, beanKey);
            info.setDescriptor(desc);
            infos.add(info);
        }
    }
    return infos.toArray(new ModelMBeanAttributeInfo[infos.size()]);
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) PropertyDescriptor(java.beans.PropertyDescriptor) ArrayList(java.util.ArrayList) Descriptor(javax.management.Descriptor) PropertyDescriptor(java.beans.PropertyDescriptor) Method(java.lang.reflect.Method)

Aggregations

ModelMBeanAttributeInfo (javax.management.modelmbean.ModelMBeanAttributeInfo)56 ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)25 Test (org.junit.Test)18 Descriptor (javax.management.Descriptor)16 ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)10 ModelMBeanInfoSupport (javax.management.modelmbean.ModelMBeanInfoSupport)7 DescriptorSupport (javax.management.modelmbean.DescriptorSupport)6 Method (java.lang.reflect.Method)5 RuntimeOperationsException (javax.management.RuntimeOperationsException)4 FileLogger (mx4j.log.FileLogger)4 Logger (mx4j.log.Logger)4 MBeanLogger (mx4j.log.MBeanLogger)4 ArrayList (java.util.ArrayList)3 Attribute (javax.management.Attribute)3 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)3 MBeanServer (javax.management.MBeanServer)3 ObjectName (javax.management.ObjectName)3 ModelMBean (javax.management.modelmbean.ModelMBean)3 ModelMBeanNotificationInfo (javax.management.modelmbean.ModelMBeanNotificationInfo)3 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)3