1 23 24 package com.sun.enterprise.admin.server.core.jmx; 25 26 import javax.management.MBeanServer ; 27 import java.lang.management.ManagementFactory ; 28 29 35 public class AppServerMBeanServerFactory { 36 37 private static MBeanServer _mbs = null; 38 39 46 public synchronized static MBeanServer getMBeanServerInstance() 47 throws InitException { 48 if (_mbs == null) { 49 _mbs = getAppServerMBeanServer(); 50 } 53 return ( _mbs ); 54 } 55 56 64 private static MBeanServer getAppServerMBeanServer() { 65 MBeanServer ms = null; 66 synchronized (AppServerMBeanServerBuilder.class) { 67 AppServerMBeanServerBuilder.enableAppServerMBeanServer(true); 68 try { 69 ms = ManagementFactory.getPlatformMBeanServer(); 70 } finally { 71 AppServerMBeanServerBuilder.enableAppServerMBeanServer(false); 72 } 73 } 74 return ms; 75 } 76 } 77 | Popular Tags |