当前位置: 首页>>代码示例>>Java>>正文


Java GarbageCollectorMXBean.isValid方法代码示例

本文整理汇总了Java中java.lang.management.GarbageCollectorMXBean.isValid方法的典型用法代码示例。如果您正苦于以下问题:Java GarbageCollectorMXBean.isValid方法的具体用法?Java GarbageCollectorMXBean.isValid怎么用?Java GarbageCollectorMXBean.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.management.GarbageCollectorMXBean的用法示例。


在下文中一共展示了GarbageCollectorMXBean.isValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGCStatst

import java.lang.management.GarbageCollectorMXBean; //导入方法依赖的package包/类
/**
 * Returns a map of garbage collectors and their stats.
 * The first object in the array is the total count since JVM start and the
 * second is the total time (ms) since JVM start.
 * If a garbage collectors does not support the collector MXBean, then it
 * will not be represented in the map.
 * @return A non-null map of garbage collectors and their metrics. The map
 * may be empty.
 */
public static Map<String, Long[]> getGCStatst() {
  final List<GarbageCollectorMXBean> gcBeans =
      ManagementFactory.getGarbageCollectorMXBeans();
  final Map<String, Long[]> map = new HashMap<String, Long[]>(gcBeans.size());
  for (final GarbageCollectorMXBean bean : gcBeans) {
    if (!bean.isValid() || bean.getCollectionCount() < 0 ||
        bean.getCollectionTime() < 0) {
      continue;
    }

    final Long[] measurements = new Long[]{
        bean.getCollectionCount(),
        bean.getCollectionTime()
    };
    map.put(bean.getName().replace(" ", "_"), measurements);
  }
  return map;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:Utils.java

示例2: initGC

import java.lang.management.GarbageCollectorMXBean; //导入方法依赖的package包/类
private void initGC() {
  List<GarbageCollectorMXBean> l = ManagementFactory.getGarbageCollectorMXBeans();
  for (GarbageCollectorMXBean item : l) {
    if (item.isValid() && !gcMap.containsKey(item)) {
      gcMap.put(item, this.f.createStatistics(gcType, item.getName(), this.id));
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:VMStats50.java

示例3: refreshGC

import java.lang.management.GarbageCollectorMXBean; //导入方法依赖的package包/类
private void refreshGC() {
  Iterator<Map.Entry<GarbageCollectorMXBean, Statistics>> it = gcMap.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry<GarbageCollectorMXBean, Statistics> me = it.next();
    GarbageCollectorMXBean gc = me.getKey();
    Statistics s = me.getValue();
    if (!gc.isValid()) {
      s.close();
      it.remove();
    } else {
      s.setLong(gc_collectionsId, gc.getCollectionCount());
      s.setLong(gc_collectionTimeId, gc.getCollectionTime());
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:16,代码来源:VMStats50.java

示例4: refreshGC

import java.lang.management.GarbageCollectorMXBean; //导入方法依赖的package包/类
private void refreshGC() {
  Iterator<Map.Entry<GarbageCollectorMXBean,Statistics>> it = gcMap.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry<GarbageCollectorMXBean,Statistics> me = it.next();
    GarbageCollectorMXBean gc = me.getKey();
    Statistics s = me.getValue();
    if (!gc.isValid()) {
      s.close();
      it.remove();
    } else {
      s.setLong(gc_collectionsId, gc.getCollectionCount());
      s.setLong(gc_collectionTimeId, gc.getCollectionTime());
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:16,代码来源:VMStats50.java


注:本文中的java.lang.management.GarbageCollectorMXBean.isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。