//If the platform MBeanServer was set up to be the PluggableMBeanServer, use that otherwise create a new one and delegate
MBeanServer platform = ManagementFactory.getPlatformMBeanServer();
PluggableMBeanServerImpl pluggable = platform instanceof PluggableMBeanServerImpl ? (PluggableMBeanServerImpl)platform : new PluggableMBeanServerImpl(platform);
if (resolvedDomainName != null || expressionsDomainName != null) {
//TODO make these configurable
ConfiguredDomains configuredDomains = new ConfiguredDomains(resolvedDomainName, expressionsDomainName);
showModelPlugin = new ModelControllerMBeanServerPlugin(configuredDomains, modelControllerValue.getValue(), legacyWithProperPropertyFormat);
pluggable.addPlugin(showModelPlugin);
}
mBeanServer = pluggable;
}