Back to index

munin  2.0.1
MemoryObjectsPending.java
Go to the documentation of this file.
00001 package org.munin.plugin.jmx;
00002 
00003 import java.io.IOException;
00004 import java.lang.management.ManagementFactory;
00005 import java.lang.management.MemoryMXBean;
00006 
00007 import org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.Graph;
00008 
00009 @Graph(title = "MemoryObjectsPending", vlabel = "objects", info = "The approximate number of objects for which finalization is pending.")
00010 public class MemoryObjectsPending extends AbstractAnnotationGraphsProvider {
00011 
00012        public MemoryObjectsPending(Config config) {
00013               super(config);
00014        }
00015 
00016        @Field
00017        public int objects() throws IOException {
00018               MemoryMXBean mbean = ManagementFactory.newPlatformMXBeanProxy(
00019                             getConnection(), ManagementFactory.MEMORY_MXBEAN_NAME,
00020                             MemoryMXBean.class);
00021 
00022               return mbean.getObjectPendingFinalizationCount();
00023        }
00024 
00025        public static void main(String args[]) {
00026               runGraph(args);
00027        }
00028 }