metadata.setClassLoader(implementation.getClass().getClassLoader());
metadata.setMBeanStandard(true);
metadata.setMBeanInterface(management);
MBeanIntrospector introspector = new MBeanIntrospector();
introspector.introspect(metadata);
if (!introspector.isMBeanCompliant(metadata)) return null;
return metadata;
}