Back to index

munin  2.0.1
ClassesUnloaded.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.ClassLoadingMXBean;
00005 import java.lang.management.ManagementFactory;
00006 
00007 import org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.Graph;
00008 
00009 
00010 @Graph(title = "ClassesUnloaded", vlabel = "classes", info = "The total number of classes unloaded since the Java virtual machine has started execution.")
00011 public class ClassesUnloaded extends AbstractAnnotationGraphsProvider {
00012 
00013        public ClassesUnloaded(Config config) {
00014               super(config);
00015        }
00016 
00017        @Field
00018        public long unloadedClass() throws IOException {
00019               ClassLoadingMXBean classmxbean = ManagementFactory
00020                             .newPlatformMXBeanProxy(getConnection(),
00021                                           ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
00022                                           ClassLoadingMXBean.class);
00023               return classmxbean.getUnloadedClassCount();
00024        }
00025 
00026        public static void main(String args[]) {
00027               runGraph(args);
00028        }
00029 }