code: static void initializeExtension(ExtensionRegistry extensionRegistry, String module,
                                      ManagementResourceRegistration rootRegistration,
                                      ExtensionRegistryType extensionRegistryType) {
          try {
              boolean unknownModule = false;
              boolean initialized = false;
              for (Extension extension : Module.loadServiceFromCallerModuleLoader(module, Extension.class)) {
                  ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass());
                  try {
                      if (unknownModule || !extensionRegistry.getExtensionModuleNames().contains(module)) {
                          // This extension wasn't handled by the standalone.xml or domain.xml parsing logic, so we
                          // need to initialize its parsers so we can display what XML namespaces it supports
                          extensionRegistry.initializeParsers(extension, module, null);
                          // AS7-6190 - ensure we initialize parsers for other extensions from this module
                          // now that we know the registry was unaware of the module
                          unknownModule = true;
                      }
                      extension.initialize(extensionRegistry.getExtensionContext(module, rootRegistration, extensionRegistryType));
                  } finally {
                      WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
                  }
                  initialized = true;
              }
              if (!initialized) {
                  throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module);
              }
          } catch (ModuleNotFoundException e) {
              // Treat this as a user mistake, e.g. incorrect module name.
              // Throw OFE so post-boot it only gets logged at DEBUG.
              throw ControllerLogger.ROOT_LOGGER.extensionModuleNotFound(e, module);
          } catch (ModuleLoadException e) {
              // The module is there but can't be loaded. Treat this as an internal problem.
              // Throw a runtime exception so it always gets logged at ERROR in the server log with stack trace details.
              throw ControllerLogger.ROOT_LOGGER.extensionModuleLoadingFailure(e, module);
          }
      }
docs: Initialise an extension module's extensions in the extension registry
  
  @param extensionRegistry the extension registry
  @param module the name of the module containing the extensions
  @param rootRegistration The parent registration of the extensions. For a server or domain.xml extension, this will be the root resource registration. For a host.xml extension, this will be the host resource registration
  @param extensionRegistryType The type of the registry