當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。