TestMetricsSourceAdapter.java 文件源码

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

项目:hadoop-oss 作者:
@Override
public void run() {
  try {
    // This will trigger updateJmxCache().
    MBeanInfo info = sa.getMBeanInfo();
    final String key = src.getKey();
    for (MBeanAttributeInfo mBeanAttributeInfo : info.getAttributes()) {
      // Found the new key, update the metric source and move on.
      if (mBeanAttributeInfo.getName().equals(key)) {
        LOG.info("found key/val=" + cnt + "/" + cnt);
        cnt++;
        src.setKV("key" + cnt, cnt);
        return;
      }
    }
    LOG.error("key=" + key + " not found. Stopping now.");
    hasError.set(true);
  } catch (Exception e) {
    // catch other errors
    hasError.set(true);
    LOG.error(e.getStackTrace());
  } finally {
    if (hasError.get()) {
      future.cancel(false);
    }
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号