public static synchronized MBeanServer getPlatformMBeanServer ()

Returns the platform MBeanServer. On the first call to this method, it first creates the platform MBeanServer by calling the MBeanServerFactory.createMBeanServer method and registers each platform MXBean in this platform MBeanServer with its ObjectName. This method, in subsequent calls, will simply return the initially created platform MBeanServer.

MXBeans that get created and destroyed dynamically, for example, memory pools and managers, will automatically be registered and deregistered into the platform MBeanServer.

If the system property javax.management.builder.initial is set, the platform MBeanServer creation will be done by the specified javax.management.MBeanServerBuilder.

It is recommended that this platform MBeanServer also be used to register other application managed beans besides the platform MXBeans. This will allow all MBeans to be published through the same MBeanServer and hence allow for easier network publishing and discovery. Name conflicts with the platform MXBeans should be avoided.

Returns:  the platform MBeanServer; the platform MXBeans are registered into the platform MBeanServer at the first time this method is called.

Exceptions:
SecurityException    if there is a security manager and the caller does not have the permission required by javax.management.MBeanServerFactory.createMBeanServer.

See also:
javax.management.MBeanServerFactory, javax.management.MBeanServerFactory.createMBeanServer