1 22 package org.jboss.jmx.examples.configuration; 23 24 import org.jboss.system.ServiceMBeanSupport; 25 import org.jboss.logging.Logger; 26 27 import javax.management.ObjectName ; 28 import javax.management.MalformedObjectNameException ; 29 import javax.management.InstanceAlreadyExistsException ; 30 import javax.management.MBeanRegistrationException ; 31 32 35 public class SampleService extends ServiceMBeanSupport implements SampleServiceMBean 36 { 37 private static final Logger log = Logger.getLogger(ServiceMBeanSupport.class.getName()); 38 39 42 public String getName() 43 { 44 return "SampleService"; 45 } 46 47 55 protected void startService() throws Exception 56 { 57 super.startService(); 58 log.debug("SampleService:startService() called"); 59 createSampleConfigMBean(); 60 } 61 62 public void createSampleConfigMBean() 63 throws MalformedObjectNameException , InstanceAlreadyExistsException , MBeanRegistrationException , javax.management.NotCompliantMBeanException 64 { 65 log.debug("SampleService:createSampleConfigMBean() called"); 66 SampleConfig config = new SampleConfig(); 67 ObjectName objname = new ObjectName ("sample:name=SampleConfig"); 68 getServer().registerMBean(config, objname); 69 } 70 } | Popular Tags |