code: ServiceRegistry getServiceRegistry(final boolean modify, final Step registryActiveStep) {
          if (modify) {
              readOnly = false;
          }
  
          assert isControllingThread();
  
          Stage currentStage = this.currentStage;
          if (modify) {
              if (!isRuntimeChangeAllowed()) {
                  throw ControllerLogger.ROOT_LOGGER.serviceRegistryRuntimeOperationsOnly();
              }
          } else {
              assertNotComplete(currentStage);
          }
          authorize(false, modify ? READ_WRITE_RUNTIME : READ_RUNTIME);
          if (modify) {
              ensureWriteLockForRuntime();
          }
          OperationContextServiceRegistry registry = new OperationContextServiceRegistry(modelController.getServiceRegistry(), registryActiveStep);
          serviceRegistries.add(registry);
          return registry;
      }
docs: Gets a service registry that will ensure
  {@link org.jboss.msc.service.ServiceController#setMode(org.jboss.msc.service.ServiceController.Mode) changes to the mode}
  of registered services will result in subsequent verification of service stability.
  
  @param modify {@code true} if the caller intends to modify state
  @param registryActiveStep the {@link org.jboss.as.controller.AbstractOperationContext.Step} that encapsulates
  the {@link org.jboss.as.controller.OperationStepHandler} that is making the call.
  @return the service registry