JmxMonitoredMap.java 文件源码

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

项目:NYBC 作者:
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<MBeanAttributeInfo>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号