1 8 9 package mx4j.examples.mbeans.helloworld; 10 11 import javax.management.MBeanServer ; 12 import javax.management.MBeanServerFactory ; 13 import javax.management.ObjectName ; 14 15 32 public class HelloWorldExample 33 { 34 public static void main(String [] args) throws Exception 35 { 36 MBeanServer server = MBeanServerFactory.createMBeanServer(); 38 39 ObjectName name = new ObjectName (":mbean=helloworld"); 41 42 server.createMBean("mx4j.examples.mbeans.helloworld.HelloWorld", name, null); 44 45 server.invoke(name, "reloadConfiguration", new Object [0], new String [0]); 47 48 Integer times = (Integer )server.getAttribute(name, "HowManyTimes"); 50 51 System.out.println("The configuration was reloaded " + times + " times."); 52 } 53 } 54 | Popular Tags |