List of usage examples for java.lang.management GarbageCollectorMXBean getObjectName
public ObjectName getObjectName();
From source file:org.apache.hadoop.hbase.util.TestJSONMetricUtil.java
@Test public void testGetLastGCInfo() { List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean bean : gcBeans) { ObjectName on = bean.getObjectName(); Object value = JSONMetricUtil.getValueFromMBean(on, "LastGcInfo"); LOG.info("Collector Info: " + value); if (value != null && value instanceof CompositeData) { CompositeData cds = (CompositeData) value; assertNotNull(cds.get("duration")); }/*from w ww.j a va2 s . c o m*/ } }