private ManagedObjectManager registerGmbal(Object statsProvider, String mbeanName) {
   ManagedObjectManager mom = null;
   try {
     // 1 mom per statsProvider
     mom = ManagedObjectManagerFactory.createFederated(MONITORING_SERVER);
     if (mom != null) {
       mom.setJMXRegistrationDebug(false);
       if (mom.isManagedObject(statsProvider)) {
         mom.stripPackagePrefix();
         if (mbeanName != null && !mbeanName.isEmpty()) {
           if (mbeanName.indexOf('\\') > 0) {
             mbeanName = StringUtils.removeChar(mbeanName, '\\');
           }
           mbeanName = mbeanName.replaceAll(SystemPropertyConstants.SLASH, "/");
           mom.createRoot(statsProvider, mbeanName);
         } else {
           mom.createRoot(statsProvider);
         }
       } else {
         String spName = statsProvider.getClass().getName();
         logger.log(Level.INFO, notaManagedObject, new Object[] {spName});
       }
     }
     // To register hierarchy in mom specify parent ManagedObject, and the ManagedObject itself
     // DynamicMBean mbean = (DynamicMBean)mom.register(parent, obj);
   } catch (Exception e) {
     // createRoot failed - need to return a null mom so we know not to unregister an mbean that
     // does not exist
     mom = null;
     logger.log(Level.SEVERE, gmbalRegistrationFailed, e);
   }
   return mom;
 }
  @Override
  public void mbeanRegistered(
      javax.management.ObjectName objectName, org.glassfish.external.amx.MBeanListener listener) {
    ObjectName MONITORING_SERVER = AMXGlassfish.DEFAULT.serverMon(AMXGlassfish.DEFAULT.dasName());
    mom = ManagedObjectManagerFactory.createFederated(MONITORING_SERVER);
    if (mom != null) {
      mom.setJMXRegistrationDebug(false);
      mom.stripPackagePrefix();
      mom.createRoot(deploymentBean, "webservices-deployment");
    }

    LazyMOMProvider.INSTANCE.initMOMForScope(LazyMOMProvider.Scope.GLASSFISH_JMX);
  }