Back to index

munin  2.0.1
ClassesLoaded.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 @Graph(title = "ClassesLoaded", vlabel = "classes", info = "The number of classes that are currently loaded in the Java virtual machine.")
00010 public class ClassesLoaded extends AbstractAnnotationGraphsProvider {
00011        public ClassesLoaded(Config config) {
00012               super(config);
00013        }
00014 
00015        @Field
00016        public int classesLoaded() throws IOException {
00017               ClassLoadingMXBean classmxbean = ManagementFactory
00018                             .newPlatformMXBeanProxy(getConnection(),
00019                                           ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
00020                                           ClassLoadingMXBean.class);
00021               return classmxbean.getLoadedClassCount();
00022        }
00023 
00024        public static void main(String args[]) {
00025               runGraph(args);
00026        }
00027 }