JmxConnection.java 文件源码

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

项目:eZooKeeper 作者:
public MBeanAttribute getMBeanAttribute(MBean mbean, String attributeName) {

        if (mbean == null) {
            throw new IllegalArgumentException("null MBean");
        }

        if (attributeName == null) {
            throw new IllegalArgumentException("null attributeName");
        }

        // TODO: Handle connection errors and try to reconnect.

        MBeanAttributeInfo attributeInfo = mbean.getAttributeInfo(attributeName);
        MBeanAttribute mbeanAttribute = new MBeanAttribute(attributeName);
        mbeanAttribute.setInfo(attributeInfo);

        Object value = null;

        try {
            value = _MBeanServerConnection.getAttribute(mbean.getObjectName(), attributeName);
        }
        catch (Throwable t) {
            String errorMessage = t.getLocalizedMessage();
            mbeanAttribute.setValueRetrievalErrorMessage(errorMessage);
        }

        mbeanAttribute.setValue(value);
        return mbeanAttribute;
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号