{
introspector.introspect(metadata);
if (!introspector.isMBeanCompliant(metadata)) throw new NotCompliantMBeanException("MBean is not compliant");
MBeanServerInterceptor head = getHeadInterceptor();
head.registration(metadata, MBeanServerInterceptor.PRE_REGISTER);
// The MBean implementor could have replaced the ObjectName with a subclass that is not secure, secure it again
metadata.setObjectName(secureObjectName(metadata.getObjectName()));
int postRegisterFlag = MBeanServerInterceptor.POST_REGISTER_FALSE;
try
{
register(metadata, privileged);
postRegisterFlag = MBeanServerInterceptor.POST_REGISTER_TRUE;
}
finally
{
head.registration(metadata, postRegisterFlag);
}
Object mbean = metadata.getMBean();
if (mbean instanceof ClassLoader && !(mbean instanceof PrivateClassLoader))
{