Java Code Examples for java.lang.management.GarbageCollectorMXBean#isValid()

The following examples show how to use java.lang.management.GarbageCollectorMXBean#isValid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VMStats50.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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));
    }
  }
}
 
Example 2
Source File: VMStats50.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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());
    }
  }
}
 
Example 3
Source File: VMStats50.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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));
    }
  }
}
 
Example 4
Source File: VMStats50.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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());
    }
  }
}