ModelMBeanInfoSupport.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
public ModelMBeanAttributeInfo getAttribute(String inName)
throws MBeanException, RuntimeOperationsException {
    ModelMBeanAttributeInfo retInfo = null;
    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
    }
    if (inName == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("Attribute Name is null"),
                "Exception occurred trying to get the " +
                "ModelMBeanAttributeInfo of the MBean");
    }
    MBeanAttributeInfo[] attrList = modelMBeanAttributes;
    int numAttrs = 0;
    if (attrList != null) numAttrs = attrList.length;

    for (int i=0; (i < numAttrs) && (retInfo == null); i++) {
        if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
            final StringBuilder strb = new StringBuilder()
            .append("\t\n this.getAttributes() MBeanAttributeInfo Array ")
            .append(i).append(":")
            .append(((ModelMBeanAttributeInfo)attrList[i]).getDescriptor())
            .append("\t\n this.modelMBeanAttributes MBeanAttributeInfo Array ")
            .append(i).append(":")
            .append(((ModelMBeanAttributeInfo)modelMBeanAttributes[i]).getDescriptor());
            MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString);
        }
        if (inName.equals(attrList[i].getName())) {
            retInfo = ((ModelMBeanAttributeInfo)attrList[i].clone());
        }
    }
    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
    }

    return retInfo;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号